亚洲乱码中文字幕综合,中国熟女仑乱hd,亚洲精品乱拍国产一区二区三区,一本大道卡一卡二卡三乱码全集资源,又粗又黄又硬又爽的免费视频

線路分流自動(dòng)智能跳轉(zhuǎn)代碼,自動(dòng)選擇最快鏡像網(wǎng)站(js)

 更新時(shí)間:2011年10月31日 14:06:47   作者:  
線路分流自動(dòng)智能跳轉(zhuǎn)代碼,自動(dòng)選擇最快鏡像網(wǎng)站,自動(dòng)選擇電信或網(wǎng)通線路跳轉(zhuǎn)代碼
JS腳本無(wú)數(shù)據(jù)庫(kù)代碼
復(fù)制代碼 代碼如下:

<Script Langage=Javascript>
i=1
var autourl=new Array()
autourl[1]="http://www.abc.com/default.asp" //修改為網(wǎng)通訪問(wèn)地址
autourl[2]="http://abc.com/default.asp" //修改為電信訪問(wèn)地址
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腳本數(shù)據(jù)庫(kù)代碼
復(fù)制代碼 代碼如下:

'版權(quán)所有
<%
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 "數(shù)據(jù)庫(kù)正在更新中,請(qǐng)稍后再試!"'注釋,需要把這幾個(gè)字翻譯成英文。
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" '是網(wǎng)通的話則跳轉(zhuǎn)到網(wǎng)通的網(wǎng)址去,自己修改為自己的網(wǎng)站
Else
response.redirect "http://www.****.com" '不是網(wǎng)通的則跳轉(zhuǎn)到的網(wǎng)址,自己修改,不廢話了
end if
rs1.close
set rs1=nothing
conn.close
set conn=nothing
end if%>

如:
復(fù)制代碼 代碼如下:

<html>
<head>
<title>標(biāo)題</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>您好!正在為您自動(dòng)選擇最快的線路</span><strong>標(biāo)題</strong><br>
<br>
<span class="style1">速度測(cè)試中……</span></div>
<div style="display:none;">
</div>
<div align="center">
<script>
i=1
var autourl=new Array()
autourl[1]="電信地址" //修改為電信訪問(wèn)地址
autourl[2]="網(wǎng)通地址" //修改為網(wǎng)通訪問(wèn)地址
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>
</div></td>
</tr>
</table>
</body>
</html>

另一實(shí)例:
復(fù)制代碼 代碼如下:

<%
'-------------------------------------------------------------------------------------------------
Function GetUserIPInfo '根據(jù)當(dāng)前用戶使用線路信息
Set XMLHTTP = Server.CreateObject("MSXML2.XMLHTTP")
'XMLHTTP.Open "Get","http://www.dns7.cn/ip/?ip="&GetUserIP(),false
XMLHTTP.Open "Get","http://www.dns7.cn/ip/?ip=60.12.1.2",false
XMLHTTP.Send
strResult= bytes2BSTR(XMLHTTP.ResponseBody)
GetUserIPInfo=strResult
End Function
'-------------------------------------------------------------------------------------------------
Function RemoteGetIPInfo(IP) '根據(jù)用戶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) '內(nèi)部函數(shù)調(diào)用
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("202.108.9.16")
%>
<br>
<%
Response.write GetUserIPInfo
%>

這個(gè)可以實(shí)現(xiàn)多服務(wù)器分流,可以實(shí)現(xiàn)線路自動(dòng)識(shí)別跳轉(zhuǎn),其原理很簡(jiǎn)單,無(wú)論用戶進(jìn)入你哪個(gè)服務(wù)器只要你在默認(rèn)頁(yè)面使用這個(gè)代碼,他就會(huì)跳轉(zhuǎn)到訪問(wèn)速度最快的服務(wù)器,這樣可以實(shí)現(xiàn)服務(wù)器分流,適用于流量大的,有多個(gè)線路多個(gè)服務(wù)器的!
本人經(jīng)過(guò)測(cè)試非常好用
代碼一:
在要跳轉(zhuǎn)的頁(yè)面上寫上:
Copy code
復(fù)制代碼 代碼如下:

<script language="JavaScript">
var m=50000;
var n=Math.floor(Math.random()*m+1)
//alert(n);
document.write("<iframe src=http://cnc.jb51.net/test.htm?"+n+"||"+location.search.replace(/\?/g,"")+" WIDTH=0 HEIGHT=0 MARGINHEIGHT=0 MARGINWIDTH=0 FRAMEBORDER=0 SCROLLING=NO></iframe>");
document.write("<iframe src=http://dx.jb51.net/test.htm?"+n+"||"+location.search.replace(/\?/g,"")+" WIDTH=0 HEIGHT=0 MARGINHEIGHT=0 MARGINWIDTH=0 FRAMEBORDER=0 SCROLLING=NO></iframe>");
document.write("<iframe src=http://chabaoo.cn/test.htm?"+n+"||"+location.search.replace(/\?/g,"")+" WIDTH=0 HEIGHT=0 MARGINHEIGHT=0 MARGINWIDTH=0 FRAMEBORDER=0 SCROLLING=NO></iframe>");
</script>


--------------------------------------------------------------------------------------
然后寫test.htm頁(yè)面代碼:注意每個(gè)服務(wù)器站點(diǎn)(我上面代碼分別為網(wǎng)通,電信,鐵通)你自己根據(jù)自己站點(diǎn)情況修改里面的網(wǎng)址,這里只是演示,上面網(wǎng)址并不存在,在那幾個(gè)服務(wù)器里面都放下面的test.htm) 都要放這個(gè)文件:
Copy code
復(fù)制代碼 代碼如下:

<script language="JavaScript">
/*
這里寫上一些文字,不要太多150-200行就可以了,主要作用是,如果你的站點(diǎn)默認(rèn)頁(yè)面為DEFAULT。HTM你把代碼一,放上去后他會(huì)檢測(cè)你所有服務(wù)器的test.htm,然后讀取test.htm文件,尋找最快的頁(yè)面,哪個(gè)訪問(wèn)速度快就進(jìn)哪個(gè)站點(diǎn),這里要寫上文字,就是為了讓他來(lái)檢測(cè)讀取速度,也不要太少,太少檢測(cè)不出速度!
*/
if (top.location !== self.location) {
top.location=self.location;
}
var url1,url2;
url1=location.search.replace(/\?/g,"")
url2=url1.split("||");
location.href="index.htm";
</script>

相關(guān)文章

最新評(píng)論