Code for JS and ASP second-level domain name redirection

Source: Internet
Author: User

I have already used the second-level domain name redirection for asp, but I can't use another method: I can't use the Redirection Program for front-end JS and ASP, the program has been debugged but cannot be switched. I don't know why. Please help me identify the cause. Thank you !!!
<%
Dim whkDbq, whkSql, whkRs, whkCount
Set whkConn = Server. CreateObject ("ADODB. Connection ")
WhkDbq = Server. MapPath ("SqlTaoFun. mdb ")
WhkConn. Open "Provider = Microsoft. Jet. OLEDB.4.0; Data Source =" & whkDbq
WhkSql = "select bh, id from UserInfo where State = '3 '"
Set whkRS = Server. CreateObject ("ADODB. Recordset ")
WhkRs. open whkSql, whkConn, 3
%>
<Script language = "javascript">
Var records = [], whkCoun = 0, whkFlag = 0;
<%
Do while not whkRs. Eof
%>
Records [whkCoun] = new Array ("<% = whkRs (" bh ") %>", "<% = whkRs (" id ") %> ");
Document. write ("whkCoun:" + whkCoun + "records [" + whkCoun + "]: "+ records [whkCoun] [0] + records [whkCoun] [1] +" <br> ");
WhkCoun = whkCoun + 1;
<%
WhkRs. MoveNext
'Whkconn = whkConn + 1
Loop
'Response. End ()
%>
WhkUrl = document. location. href;
Document. write (whkUrl)
WhkUrl = whkUrl. replace ("http ://","");
WhkUrl = whkUrl. substring (0, whkUrl. indexOf ("/"));
Document. write ("<br> whkUrl:" + whkUrl );
If (whkUrl. toLowerCase ()! = "Www.taofun.cn ")
{
Var whkFirstP = whkUrl. indexOf ("."), whkEndP = whkUrl. lastIndexOf ("."), gotoUrl;
If (whkFirstP = whkEndP) & (whkFirstP! =-1) | (whkEndP! =-1 )))
{
WhkFlag = 0;
Window. alert ("taofun.cn ");
// Window. location. href = "http://www.taofun.cn /"
}
Else
{
If (whkUrl = "localhost ")
{
WhkFlag = 0;
Window. alert ("localhost ");
}
Else
{

Var whkUrl2 = whkUrl. substring (0, whkUrl. indexOf ("."));
Document. write ("<br> whkUrl2:" + whkUrl2 );
If (whkUrl2.toLowerCase () = "www ")
{
If (whkUrl. indexOf (".", whkFirstP + 1) = whkUrl. lastIndexOf (".", whkEndP-1 ))
For (I = 0; I <whkCoun; I ++)
{
Document. write ("<br> the read bh:" + records [I] [0]);
If (records [I] [0] = whkUrl. substring (whkFirstP + 1, whkUrl. indexOf (".", whkFirstP + 1 )))
{
WhkFlag = 1;
GotoUrl = "http://www.taofun.cn/show/Shop.asp? Id = "+ records [I] [1];
Window. alert ("find" + records [I] [0] + "second-level domain name. ");
Break;
}
}
Else
{
WhkFlag = 0;
Window. alert ("too many inputs! ");
// Window. location. href = "http://www.taofun.cn /";
}
}
Else
{
WhkFlag = 0;
Window. alert ("Start with www ");
// Window. location. href = "http://www.taofun.cn /";
}
}
}
}
Else
{
WhkFlag = 0;
Window. alert ("go to the homepage! ");
// Window. location. href = whkUrl;
}
Document. write ("<br> final result:" + gotoUrl + whkwhkwhk );
If (whkFlag = 1)
{
Document. write ("<frameset cols = \" * \ "> <frame frameborder = \" 0 \ "scrolling = \" auto \ "src = \" "+ gotoUrl + "\"> <\/frameset> ");
}
</Script>

Related Article

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.