JS加ASP次層網域轉向的代碼

來源:互聯網
上載者:User

自己做了asp的次層網域轉向已經使用當中,但用到另一種方法:前台JS加ASP的轉向程式卻轉不了,程式調試已經通過但不能轉向不知道為什麼請幫忙指出原因,謝謝!!!
<%
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,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>這裡是讀取的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("找到"+records[i][0]+"的次層網域。");
break;
}
}
else
{
whkFlag = 0;
window.alert("輸的太多了!");
//window.location.href = "http://www.taofun.cn/";
}
}
else
{
whkFlag = 0;
window.alert("開頭請輸www");
//window.location.href="http://www.taofun.cn/";
}
}
}
}
else
{
whkFlag = 0;
window.alert("去網站首頁!");
//window.location.href = whkUrl;
}
document.write("<br>最後結果:"+gotoUrl+whkwhkwhk);
if (whkFlag == 1)
{
document.write("<frameset cols=\"*\"><frame frameborder=\"0\" scrolling=\"auto\" src=\""+gotoUrl+"\"><\/frameset>" );
}
</script>

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

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.