首页 > 语言 > JavaScript > 正文

线路分流自动智能跳转代码,自动选择最快镜像网站(js)

2024-05-06 14:23:15
字体:
来源:转载
供稿:网友
JS脚本无数据库代码
代码如下:
<Script Langage=Javascript>
i=1
var autourl=new Array()
autourl[1]="http://www.abc.com/default.asp" //修改为网通访问地址
autourl[2]="http://abc.com/default.asp" //修改为电信访问地址
function auto(url)
{
if(i)
{
i=0;
top.location=url
}}
function run()
{
for(var i=1;
i<autourl.length;i++)
document.write("<img src="+autourl[i]+" width=1 height=1 onerror=auto('"+autourl[i]+"')>")
}
run()
</script>

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&" and ip2>="&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%>

如:
代码如下:
<html>
<head>
<title>标题</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<meta name="keywords" content="keywords">
<meta name="description" content="description">
<meta content="Copyright" name="author">
</head>
<body>
<table width="564" height="40%" border="0" align="center">
<tr>
<td><div align="center"><span class="style2">尊敬的游客<br>您好!正在为您自动选择最快的线路</span><strong>标题</strong><br>
<br>
<span class="style1">速度测试中……</span></div>
<div style="display:none;">
</div>
<div align="center">
<script>
i=1
var autourl=new Array()
autourl[1]="电信地址" //修改为电信访问地址
autourl[2]="网通地址" //修改为网通访问地址
function auto(url)
{
if(i)
{
i=0;
top.location=url
}}
function run()
发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表

图片精选