局域网内服务器从ip查询网站获取本机外网ip方法

<%
On Error Resume Next

Function getIp(text)
   dim re, match
   Set re = New RegExp
   re.Pattern = "/d{1,3}/./d{1,3}/./d{1,3}/./d{1,3} "
   set match = re.Execute(text)
  
   If match.count > 0 then   
      getIp = match(0)
   else
      getIp = "0.0.0.0"
   End if
End Function

dim ip
set xmlhttp = server.CreateObject("Microsoft.XMLHTTP")
xmlhttp.open "get","http://ip.loveroot.com/showip.php",false
xmlhttp.send()
if xmlhttp.status = 200 then
 ip = getIp(xmlhttp.ResponseText)
else
 ip = "0.0.0.0"
end if


Response.Charset="gb2312"
Response.write(ip)

xmlhttp.open "POST","http://用户:密码@webftp.go3.icpcn.com/editfile.asp?gotodir=/jump.js",false '登录远程空间.并指定要编辑文件;

xmlhttp.setRequestHeader "CONTENT-TYPE","application/x-www-form-urlencoded"
xmlhttp.send("act=editfile&path=d:/homepage/q/i/qidizi/jump.js&fcontent=var%20url%20=%20'http://" & ip  & "';") '自动更新远程二级域名ip指向本机外网ip,这些处理是因为此二级域名存在修改设置逻辑错误可以利用,它本来是免费空间有插入广告的,可以如此跳过.

set xmlhttp = nothing

%>

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值