index.php u=,index.php

error_reporting(0);

/**

* 前台入口文件

*

* @copyright Copyright (c) 2009 - 2010 6PiMa Network Technology Co., Ltd.

* @license GNU General Public License 2.0 {@link http://www.gnu.org/licenses/gpl-2.0.html}

* @package Core

* @category File

* @author Allen

* @version $Id: index.php 2 2010-04-27 16:47:43Z allen $

**/

/**

* 网站重写规则,apache下使用.htaccess,内容如下

RewriteEngine on

RewriteBase /

RewriteCond %{HTTP_HOST} ^gaincar.com [NC]

RewriteRule ^(.*)$ http://www.uhous.com/$1 [L,R=301]

RewriteCond %{HTTP_HOST} ^www.gaincar.com [NC]

RewriteRule ^(.*)$ http://www.uhous.com/$1 [L,R=301]

RewriteCond %{HTTP_HOST} ^uhous.com [NC]

RewriteRule ^(.*)$ http://www.uhous.com/$1 [L,R=301]

RewriteRule ^((?:home|products|member|check|information)(?:/.*)?) /index.php/$1 [L,NC]

RewriteRule ^sysadm/((?:admin|advertise|columns|coupons|dashboard|download|exchange|guestbook|information|member|order|page|products|settings|setup)(?:/.*)?) /sysadm/index.php/$1 [L,NC]

ErrorDocument 404 /index.php/home/error

* nginx下在server块内加入以下规则

location / {

rewrite ^(/(?:home|products|member|check|information)(?:/.*)?) /index.php$1 last;

}

location /sysadm/ {

rewrite ^/sysadm/((?:admin|advertise|columns|coupons|dashboard|download|exchange|guestbook|information|member|order|page|products|settings|setup)(?:/.*)?) /sysadm/index.php/$1 last;

}

*

*

* 入口标识

*/

define('IN_EOMS', true);

/**

* 载入应用入口

*/

require_once './apps/application.php';

/**

* 运行应用

* 根据程序支持,选择wap1.0或2.0

* 否则运行http

*/

$ismobile = ismobile();

if ($ismobile === 1) {

application :: factory('wap')->run();

} else

if ($ismobile === 2) {

application :: factory('wap1')->run();

} else {

application :: factory('front')->run();

}

function ismobile() {

//不启用wap站点

return 0;

//已经访问过前台

if(isset($_SESSION['www']) && $_SESSION['www']){

return 0;

}

//访问域名正确直接返回内容

$serv = $_SERVER['HTTP_HOST'];

if (stripos(strtolower($serv), 'm.') !== false) {

return 1;

}

if (stripos(strtolower($serv), 'wap.') !== false) {

return 2;

}

$ismobile = false;

//否则判断

if (isset ($_SERVER['HTTP_X_WAP_PROFILE'])) {

$ismobile=true;

}

if (!$ismobile && isset ($_SERVER['HTTP_VIA'])) {

$ismobile = stristr($_SERVER['HTTP_VIA'], "wap") ? true : false;

}

if (!$ismobile && isset ($_SERVER['HTTP_USER_AGENT'])) {

$clientkeywords = array (

'nokia',

'sony',

'ericsson',

'mot',

'samsung',

'htc',

'sgh',

'lg',

'sharp',

'sie-',

'philips',

'panasonic',

'alcatel',

'lenovo',

'iphone',

'ipod',

'blackberry',

'meizu',

'android',

'netfront',

'symbian',

'ucweb',

'windowsce',

'palm',

'operamini',

'operamobi',

'openwave',

'nexusone',

'cldc',

'midp',

'wap',

'mobile'

);

// 从HTTP_USER_AGENT中查找手机浏览器的关键字

if (preg_match("/(" . implode('|', $clientkeywords) . ")/i", strtolower($_SERVER['HTTP_USER_AGENT']))) {

$ismobile = true;

}

}

$accept = $_SERVER['HTTP_ACCEPT'];

if(!$ismobile && strpos($accept, 'text/html')===false &&

(strpos($accept, 'application/xhtml+xml') !== false || strpos($accept, 'text/vnd.wap.wml') !== false)){

$ismobile = true;

}

if ($ismobile) {

if (strpos($accept, 'application/xhtml+xml') !== false) {

header('Location:http://m.uhous.net');

exit;

}

if (strpos($accept, 'text/vnd.wap.wml') !== false) {

header('Location:http://wap.uhous.net');

exit;

}

}

return 0;

}

一键复制

编辑

Web IDE

原始数据

按行查看

历史

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值