4月18

实现自动识别WAP或WEB客户端浏览器并转入相应页面

| |
07:05    ukidhulei 本站原创   From: 本站原创 不指定
       使用方法:以ASP为例,将ASP代码保存为autoindex.asp,放在你的网站根目录下,将其优先级设为最高.
                    将DNS解析到你的空间,并在你的空间控制面版上绑定域名.      

ASP源码

<%
Option Explicit
dim enterurl

if Request.ServerVariables("SERVER_NAME")="mov.blbear.com" then

       enterurl="/mov/"

elseif Request.ServerVariables("SERVER_NAME")="link.blbear.com" then

       enterurl="/link/"

elseif Request.ServerVariables("SERVER_NAME")="besturl.com.cn" then

       enterurl="/link/"

else

    if instr(Request.ServerVariables("http_accept"),"wap")>0  then

        enterurl="/wap/"
    else

        enterurl="/index.php"  
    end if
end if

Response.Redirect(enterurl)

%>

PHP源码

<?php
$eweb = $_SERVER['SERVER_NAME'];
$iswap = $_SERVER['HTTP_ACCEPT'];

if(strpos($eweb,"mov.blbear.com")>0)
        {
            header("location:http://mov.blbear.com/mov");
        }

elseif(strpos($eweb,"link.blbear.com")>0)
       {
           header("location:http://link.blbear.com/link");
       }

elseif(strpos($eweb,"besturl.com.cn")>0)
      {
          header("location:http://besturl.com.cn/link");
      }
elseif(strpos($iswap,"wap")>0)
     {
          header("location:http://blbear.com/wap/");
     }

else

   {
        header("location:http://blbear.com/index.php");  
    }
?>
阅读(850) | 评论(0) | 引用(0)
发表评论
表情
emotemotemotemotemot
emotemotemotemotemot
emotemotemotemotemot
emotemotemotemotemot
emotemotemotemotemot
打开HTML
打开UBB
打开表情
隐藏
记住我
昵称   密码   游客无需密码
网址   电邮   [注册]