<%
'*********************************
'Function: GetUserTrueIP()
'Parameters: None
'Author: Alixi
'Date: 2007/7/13
'Description: Obtain the user's real IP, and it is still valid for the proxy address; return value: text type IP address
'Example: <%=GetUserTrueIP()%>
'*********************************
FunctionGetUserTrueIP()
dimstrIPAddr
IfRequest.ServerVariables("HTTP_X_FORWARDED_FOR")=""ORInStr(Request.ServerVariables("HTTP_X_FORWARDED_FOR"),"unknown")>0Then
strIPAddr=Request.ServerVariables("REMOTE_ADDR")
ElseIfInStr(Request.ServerVariables("HTTP_X_FORWARDED_FOR"),",",")>0Then
strIPAddr=Mid(Request.ServerVariables("HTTP_X_FORWARDED_FOR"),1,InStr(Request.ServerVariables("HTTP_X_FORWARDED_FOR"),",")-1)
ElseIfInStr(Request.ServerVariables("HTTP_X_FORWARDED_FOR"),";")>0Then
strIPAddr=Mid(Request.ServerVariables("HTTP_X_FORWARDED_FOR"),1,InStr(Request.ServerVariables("HTTP_X_FORWARDED_FOR"),";")-1)
Else
strIPAddr=Request.ServerVariables("HTTP_X_FORWARDED_FOR")
EndIf
GetUserTrueIP=Trim(Mid(strIPAddr,1,30))
EndFunction
%>