::烟舞者::

   

------------------------------------------

-=努力学习后台编程=-

 
程序判断访问线路(收藏自经典ydjjld)
作者:半支烟  发表时间:2005-7-10

 


<%
'-------------------------------------------------------------------------------------------------
Function GetUserIPInfo '根据当前用户使用线路信息
Set XMLHTTP = Server.CreateObject("MSXML2.XMLHTTP")
XMLHTTP.Open "Get","http://www.dns7.cn/ip/?ip="&GetUserIP(),false
XMLHTTP.Send
strResult= bytes2BSTR(XMLHTTP.ResponseBody)
GetUserIPInfo=strResult
End Function
'-------------------------------------------------------------------------------------------------
Function RemoteGetIPInfo(IP) '根据用户IP,得到使用线路信息
Set XMLHTTP = Server.CreateObject("MSXML2.XMLHTTP")
XMLHTTP.Open "Get","http://www.dns7.cn/ip/?ip="&IP,false
XMLHTTP.Send
strResult= bytes2BSTR(XMLHTTP.ResponseBody)
RemoteGetIPInfo=strResult
End Function
'-------------------------------------------------------------------------------------------------
Function GetUserIP() '得到用户IP地址
Dim userip,userip2
userip = Request.ServerVariables("HTTP_X_FORWARDED_FOR")
userip2 = Request.ServerVariables("REMOTE_ADDR")
If userip = "" Then
GetUserIP=userip2
Else
GetUserIP=userip
End If
End Function
'-------------------------------------------------------------------------------------------------
Function bytes2BSTR(vIn) '内部函数调用
strReturn = ""
For i = 1 To LenB(vIn)
ThisCharCode = AscB(MidB(vIn,i,1))
If ThisCharCode < &H80 Then
strReturn = strReturn & Chr(ThisCharCode)
Else
NextCharCode = AscB(MidB(vIn,i+1,1))
strReturn = strReturn & Chr(CLng(ThisCharCode) * &H100 + CInt(NextCharCode))
i = i + 1
End If
Next
bytes2BSTR = strReturn
End Function
'-------------------------------------------------------------------------------------------------

%>

<%
Response.write GetUserIP()
%>
<br>
<%
Response.write RemoteGetIPInfo(GetUserIP())
%>
<br>
<%
Response.write GetUserIPInfo
%>

----------------------------------------
 

 

半支烟发表于:ASP  


 
留言内容(共有条)


{CommentAuthor}评论说:
{CommentContent}

--- {CommentTime} {CommentUrl}


 

流年--似水


也说--几句


 来来--往往


 

 快速--登陆

*用户名:
*密   码:

 


日志--搜索


踩上--几脚

 
zzj 最新的 20 条日志
 

 

 

Designed By UBABY--2005