Line shunt automatic Intelligent Jump Code, automatically choose the fastest mirror site (JS) _javascript skills

Source: Internet
Author: User
Tags servervariables
JS script has no database code
Copy Code code as follows:

<script langage=javascript>
I=1
var autourl=new Array ()
autourl[1]= "http://www.abc.com/default.asp"//modified for Netcom access address
autourl[2]= "http://abc.com/default.asp"//modified for telecommunications access address
function Auto (URL)
{
if (i)
{
i=0;
Top.location=url
}}
function Run ()
{
for (Var I=1;
i<autourl.length;i++)
document.write (")
}
Run ()
</script>

JS Script Database Code
Copy Code code as follows:

' All rights reserved.
<%
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 "Database is being updated, please try again later!" "' Note, you need to translate these words into English.
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" is Netcom's words to go to Netcom's web site to modify their own website
Else
Response.Redirect "http://www.****.com" is not Netcom's jump to the URL, their own changes, not nonsense
End If
Rs1.close
Set rs1=nothing
Conn.close
Set conn=nothing
End If%>

Such as:
Copy Code code as follows:

<title> 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" >
<body>
<table width= "564" height= "40%" border= "0" align= "center" >
<tr>
<td><div align= "center" ><span class= "Style2" > Honored visitors <br> Hello! The fastest line </span><strong> title </strong><br> is being automatically selected for you
<br>
<span class= "Style1" > Speed test ......</span></div>
<div style= "Display:none;" >
</div>
<div align= "center" >
<script>
I=1
var autourl=new Array ()
autourl[1]= "Telecommunications Address"//change to telecommunications access address
autourl[2]= "Netcom Address"//change for netcom access address
function Auto (URL)
{
if (i)
{
i=0;
Top.location=url
}}
function Run ()
{
for (Var i=1;i<autourl.length;i++)
document.write ("}
Run ()
</script>
</div></td>
</tr>
</table>
</body>

Another example:
Copy Code code as follows:

<%
'-------------------------------------------------------------------------------------------------
Function Getuseripinfo ' use line information based on current user
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) ' According to user IP, get the use of line information
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 () ' Get User IP address
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) ' Internal functions call
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
%>

This enables multiple server streaming, can realize line automatic recognition jump, its principle is very simple, regardless of user enter your server as long as you use this code in the default page, he will jump to the fastest access to the server, so you can achieve server streaming, applicable to large traffic, there are multiple lines of multiple servers!
I have been tested very good
Code One:
On the page you want to jump on, write:
Copy Code
Copy Code code as follows:

<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://www.jb51.net/test.htm?") +n+ "| |" +location.search.replace (/\?/g, "") + "width=0 height=0 marginheight=0 marginwidth=0 frameborder=0 SCROLLING=NO> </iframe> ");
</script>


--------------------------------------------------------------------------------------
Then write test.htm page code: note that each server site (I above the code for Netcom, Telecom, railcom) your own site according to the changes inside the URL, here is only demo, the above Web site does not exist, in those several servers are placed below the test.htm to put this file:
Copy Code
Copy Code code as follows:

<script language= "JavaScript" >
/*
Here write some text, not too much 150-200 lines can be, the main role is, if your site default page defaults. HTM you put code one, put it up after he will detect all your server test.htm, and then read the test.htm file, looking for the fastest page, which access speed to enter which site, here to write text, is to let him to detect reading speed, also not too little, too little detection speed!
*/
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>

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.