CI control judgment, and into the session, for other access pages, to determine whether the session value is "Yes" continue to display the mobile-side style page or computer-side style page
Public Function Index ()
{
//' mobile Access ';
if (Stripos ($_server[' http_user_agent '), "Android")!=false| | Stripos ($_server[' http_user_agent '], "ios")!=false| | Stripos ($_server[' http_user_agent '], "WP")!=false) {
//echo ' mobile Access ';
Echo ' <script>alert ("You are now using mobile device access, \ nthe recommended screen horizontal display for enrollment.") ");</script> ';
$_session["IsMobile"]= "yes";
echo $_session[' IsMobile '];
$className = new Clubfront2 ();
$className->index ();
} else//Computer access
{
$className = new Clubfront2 ();
$className->index ();}}
Another way of writing
<?php function IsMobile () {$useragent =isset ($_server[' http_user_agent '])? $_server[' Http_user_agent ']: ';
$useragent _commentsblock=preg_match (' |\ (. *?\) | ', $useragent, $matches) >0? $matches [0]: '; function Checksubstrs ($substrs, $text) {foreach ($substrs as $substr) if (False!==strpos ($text, $substr)) {Retu
RN true;
return false; $mobile _os_list=array (' Google Wireless transcoder ', ' Windows CE ', ' WindowsCE ', ' Symbian ', ' Android ', ' armv6l ', ' armv5 '
, ' Mobile ', ' CentOS ', ' mowser ', ' AvantGo ', ' Opera mobi ', ' J2ME/MIDP ', ' Smartphone ', ' go.web ', ' Palm ', ' IPAQ '); $mobile _token_list=array (' PROFILE/MIDP ', ' configuration/cldc-', ' 160x160 ', ' 176x220 ', ' 240x240 ', ' 240x320 ', ' 320x The ', ' up. Browser ', ' up. Link ', ' SymbianOS ', ' PalmOS ', ' PocketPC ', ' SonyEricsson ', ' Nokia ', ' BlackBerry ', ' Vodafone ', ' BenQ ', ' novarra-vision ', '
Iris ', ' NetFront ', ' htc_ ', ' Xda_ ', ' samsung-sgh ', ' Wapaka ', ' DoCoMo ', ' iPhone ', ' iPod ';
$found _mobile=checksubstrs ($mobile _os_list, $useragent _commentsblock) | | ChEcksubstrs ($mobile _token_list, $useragent);
if ($found _mobile) {return true;
}else{return false;
} if (IsMobile ()) echo ' Mobile login m.php100.com '; else echo ' computer login www.php100.com ';?>