帮忙看看代码!
程序代码:
Function IP() Dim strIPAddr If Request.ServerVariables("HTTP_X_FORWARDED_FOR") = "" OR InStr(Request.ServerVariables("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.ServerVariables("HTTP_X_FORWARDED_FOR"), 1, InStr(Request.ServerVariables("HTTP_X_FORWARDED_FOR"), ",")-1) actforip=Request.ServerVariables("REMOTE_ADDR") ElseIf InStr(Request.ServerVariables("HTTP_X_FORWARDED_FOR"), ";") > 0 Then strIPAddr = Mid(Request.ServerVariables("HTTP_X_FORWARDED_FOR"), 1, InStr(Request.ServerVariables("HTTP_X_FORWARDED_FOR"), ";")-1) actforip=Request.ServerVariables("REMOTE_ADDR") Else strIPAddr = Request.ServerVariables("HTTP_X_FORWARDED_FOR") actforip=Request.ServerVariables("REMOTE_ADDR") End If IP = Trim(Mid(strIPAddr, 1, 30)) End Function
这能不能简略一些代码?
我有一个IP数据库,用什么代码来得转换IP到相应的页面?
数据库字段有 Startip Endip country ReUrl 四个字段