绑定多域名的ASP代码 及镜像站自动选择
2006.05.25 - 暂无评论 »
如果有有一个ASP空间,而你又想放置多个多个站点,这些代码可以帮到你
第一个
<%if Request.ServerVariables(”SERVER_NAME”)=”www.yyjs.com” then
response.redirect “zkj”
else
response.redirect “i.htm”
end if%>
response.redirect “zkj”
else
response.redirect “i.htm”
end if%>
第二个
<%
select case request.servervariables(”http_host”)
case “www.yyjs.com” ‘1
Server.Transfer(”v3.htm”)
case “www.aspcn.net” ‘2
Server.Transfer(”i.htm”)
case “www.yyjs.cn” ‘3
Server.Transfer(”yyjs.htm”)
select case request.servervariables(”http_host”)
case “www.yyjs.com” ‘1
Server.Transfer(”v3.htm”)
case “www.aspcn.net” ‘2
Server.Transfer(”i.htm”)
case “www.yyjs.cn” ‘3
Server.Transfer(”yyjs.htm”)
…… 继续添加 ……
end select
%>[/code]
第三个
<%if instr(Request.ServerVariables
(”SERVER_NAME”),”kekexi.com”)>0 then
response.redirect “index.asp”
else if instr(Request.ServerVariables
(”SERVER_NAME”),”4668.com”)>0 then
response.redirect “x/index.asp”
else if instr(Request.ServerVariables
(”SERVER_NAME”),”web315.com”)>0 thenr
esponse.redirect “index3.asp”
end if
end if
end if%>
(”SERVER_NAME”),”kekexi.com”)>0 then
response.redirect “index.asp”
else if instr(Request.ServerVariables
(”SERVER_NAME”),”4668.com”)>0 then
response.redirect “x/index.asp”
else if instr(Request.ServerVariables
(”SERVER_NAME”),”web315.com”)>0 thenr
esponse.redirect “index3.asp”
end if
end if
end if%>
第四个
<%if Request.ServerVariables(”SERVER_NAME”)=”www.yyjs.com” then
response.redirect “index1.asp”
else if Request.ServerVariables(”SERVER_NAME”)=”www.ce.org.cn” then
response.redirect “index2.asp”
else if Request.ServerVariables(”SERVER_NAME”)=”www.163.com” then
response.redirect “index3.asp”
end if
end if
end if%>
response.redirect “index1.asp”
else if Request.ServerVariables(”SERVER_NAME”)=”www.ce.org.cn” then
response.redirect “index2.asp”
else if Request.ServerVariables(”SERVER_NAME”)=”www.163.com” then
response.redirect “index3.asp”
end if
end if
end if%>
自动打开最快镜像站
方案一:
<html>
<head>
<META HTTP-EQUIV=”Content-Type” CONTENT=”text/html; charset=gb2312″>
<meta http-equiv=”refresh” content=”5;url=./”> //设定检测的时间,每5秒刷新一次
<title>自动选择最快站点</title></head>
<center>
<p>
<br>
<font color=blue size=7><br>
请稍候,正在选择速度最快站点……</p>
<script>
i=1
var autourl=new Array()
autourl$[$1$]$=”http://szyhbcn.y365.com”;
autourl$[$2$]$=”http://www.qxcomm.com/p_html/szyhbcn”;
autourl$[$3$]$=”http://free.yc365.com/szyhbcn”; //设置三个镜像站点,当然你也可以多加几个只要如上形式即可.
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+” mce_src=”+autourl+” width=1 height=1 onerror=auto(’”+autourl+”‘)>”) //写出具体的链接地址
}
run() //启动函数
</script>
</body></html>
<head>
<META HTTP-EQUIV=”Content-Type” CONTENT=”text/html; charset=gb2312″>
<meta http-equiv=”refresh” content=”5;url=./”> //设定检测的时间,每5秒刷新一次
<title>自动选择最快站点</title></head>
<center>
<p>
<br>
<font color=blue size=7><br>
请稍候,正在选择速度最快站点……</p>
<script>
i=1
var autourl=new Array()
autourl$[$1$]$=”http://szyhbcn.y365.com”;
autourl$[$2$]$=”http://www.qxcomm.com/p_html/szyhbcn”;
autourl$[$3$]$=”http://free.yc365.com/szyhbcn”; //设置三个镜像站点,当然你也可以多加几个只要如上形式即可.
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+” mce_src=”+autourl+” width=1 height=1 onerror=auto(’”+autourl+”‘)>”) //写出具体的链接地址
}
run() //启动函数
</script>
</body></html>
方案二:
直接将下面代码加入到<body></body>中
<script>
i=1
var autourl=new Array()
autourl$[$1$]$=”szyhbcn.y365.com”
autourl$[$2$]$=”qxcomm.com/p_html/szyhbcn”
autourl$[$3$]$=”free.yc365.com/szyhbcn”
function auto(url){if(i){i=0;top.location=url}}
function run(){for(var i=1;i<autourl.length;i++)document.write(”<img src=http://”+autourl+” width=1 height=1 onerror=auto(’http://”+autourl+”‘)>”)}
run()
</script>
i=1
var autourl=new Array()
autourl$[$1$]$=”szyhbcn.y365.com”
autourl$[$2$]$=”qxcomm.com/p_html/szyhbcn”
autourl$[$3$]$=”free.yc365.com/szyhbcn”
function auto(url){if(i){i=0;top.location=url}}
function run(){for(var i=1;i<autourl.length;i++)document.write(”<img src=http://”+autourl+” width=1 height=1 onerror=auto(’http://”+autourl+”‘)>”)}
run()
</script>
分类: 客户端脚本 -

评论
发表您的评论