Get the perfect usage of client IP

xiaoxiao2021-03-06  20

Function getip () 'acquisition client IP

DIM StripAddr

If Request.ServerVariables ("http_x_forwarded_for") = "" or inswart ("http_x_forwarded_for"), "unknown"> 0 THEN

Stripaddr = Request.servervariables ("remote_addr")

Elseif INSTR (Request.ServerVariables ("http_x_forwarded_for"), ",")> 0 THEN

Stripaddr = MID (Request.SerVariables ("http_x_forwarded_for"), 1, INSTR (Request.ServerVariables ("http_x_forwarded_for"), "," - 1)

Elseif INSTR (Request.ServerVariables ("http_x_forwarded_for"), ";"> 0 THEN

Stripaddr = MID (Request.SerVariables ("http_x_forwarded_for"), 1, INSTR (Request.ServerVariables ("http_x_forwarded_for"), ";") - 1)

Else

Stripaddr = request.servervariables ("http_x_forwarded_for")

END IF

Getip = stripAddr

END FUNCTION

转载请注明原文地址:https://www.9cbs.com/read-43479.html

New Post(0)