<% 

'=========================================================
' 获取用户的IP地址的函数
' ========================================================
Function userip()
	Dim getip
	getip = Request.ServerVariables("HTTP_X_FORWARDED_FOR") 
	If getip = "" Then getip = Request.ServerVariables("REMOTE_ADDR")
	userip=getip
End Function

'=========================================================
' 对获取来的数据进行拆分，偷到所需要的区域
' ========================================================
function getResult(res1,res2,htmls)
title1=instr(Htmls, res1)
title2=instr(Htmls, res2)
Ctitlem=mid(Htmls,title1,title2-title1) 
Ctitlem=replace(Ctitlem,res1,"")
Ctitlem=replace(Ctitlem,res2,"")
getResult=Ctitlem
end Function

'=========================================================
' 利用XMLHTTP获取数据
' ========================================================
function getHTTPPage(url) 
	dim Http 
	set Http=server.createobject("MSXML2.XMLHTTP") 
		Http.open "GET",url,false 
		Http.send() 
		if Http.readystate<>4 then 
			exit function 
		end if 
		getHTTPPage=bytesToBSTR(Http.responseBody,"GB2312")
	set http=nothing 
	if err.number<>0 then err.Clear 
end function 
'=========================================================
' 对获取过来的数据进行处理
' ========================================================
Function BytesToBstr(body,Cset) 
	dim objstream 
	set objstream = Server.CreateObject("adodb.stream") 
		objstream.Type = 1 
		objstream.Mode =3 
		objstream.Open 
		objstream.Write body 
		objstream.Position = 0 
		objstream.Type = 2 
		objstream.Charset = Cset 
		BytesToBstr = objstream.ReadText 
		objstream.Close 
	set objstream = nothing 
End Function 

'=========================================================
' 最后处理
' ========================================================
MyIP=userip()
txtURL="http://www.cz88.net/ip/default.aspx?ip="&MyIP
sText = getHTTPPage(txtURL)
beginstr="<span id=""InputIPAddrMessage"">"
endstr="</span></td>"&vbcrlf&"   </tr>"&vbcrlf&"  </tbody></table>"&vbcrlf&"<br />"
sText=getResult(beginstr,endstr,sText)
 
 
 %>
<style type="text/css">
<!--
.STYLE1 {color: #FF0000}
-->
</style>
 
您的IP地址是：<span class="STYLE1"><%=MyIP%></span><BR>经过纯真网站查询，您的数据来自：<span class="STYLE1"><%=sText%></span><BR><BR>该数据来自纯真网站，跟纯真网站同步更新，但是如果遇到网络问题，会影响到您的查询和使用。
<script type="text/javascript"><!--
google_ad_client = "pub-4384541722892070";
/* 468x15, 创建于 09-3-10 */
google_ad_slot = "4399500387";
google_ad_width = 468;
google_ad_height = 15;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>
<BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><CENTER><script type="text/javascript"><!--
google_ad_client = "pub-4384541722892070";
/* 728x90, 创建于 08-12-18 */
google_ad_slot = "8789753107";
google_ad_width = 728;
google_ad_height = 90;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script></CENTER>