JS脚本无数据库代码
JS脚本数据库代码
'版权所有
On Error Resume next
dim conn,dbpath,UserIP
set conn=server.createobject("adodb.connection")
DBPath = Server.MapPath("IP.mdb")
conn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & DBPath
If Err Then
err.Clear
Set Conn = Nothing
Response.Write "数据库正在更新中,请稍后再试!"'注释,需要把这几个字翻译成英文。
Response.End
End If
myip = Request.ServerVariables("HTTP_X_FORWARDED_FOR")
If myip = "" Then myip = Request.ServerVariables("REMOTE_ADDR")
tempip=myip
myip = Split(myip,".")
if Ubound(myip)=3 then
For i=0 To Ubound(myip)
myip(i)=left(myip(i),3)
if isnumeric(myip(i)) then
myip(i)=cint(myip(i))
else
myip(i)=0
end if
next
myipnumeber=myip(0)*256*256*256+myip(1)*256*256+myip(2)*256+myip(3)
sql="select addr from ip where ip1="&myipnumeber
set rs1=conn.execute(sql)
if not rs1.eof then
response.redirect "http://www.***.com" '是网通的话则跳转到网通的网址去,自己修改为自己的网站
Else
response.redirect "http://www.****.com" '不是网通的则跳转到的网址,自己修改,不废话了
end if
rs1.close
set rs1=nothing
conn.close
set conn=nothing
end if%>
如: