Warning: Invalid argument supplied for foreach() in /home/jihswbiz/public_html/t6.gwilt.org/refDox.php on line 212
Docs-detectMobileDevice

 

ReLoad

Keys


Functions

arraybrowsercolorcookiedatetimeDBdebugdeviceDSTequiverrorflagsfontformatgeo
holidayhtmlisjsonmathparsePHPprintsearchsortstringtabletexttracetype
VOTDweatherxml

Function  detectMobileDevice   Lines 820-873 (53 lines)Updated: 2014-09-20 file  utils.php   Last mod: Fri 2021-05-14 21:45:07

function detectMobileDevice$screenWidth )
        {
#-k     cookie html device
#-       return 0 = bot
#-              1       user agent clear indication
#-              2       SERVER WAP
#-              3       SERVER WAP
#-              4       SERVER PROFILE
#-              5       user agent clear indication
#-              6       small screen width
#-              7       user agent matched mobile type
#-d     9/20/14 - updated

        
$user_agent strtolower $_SERVER['HTTP_USER_AGENT'] );
        
$mobile_ua substr($user_agent04);
        
$mobile_agents = array(
                
'w3c ','acs-','alav','alca','amoi','audi','avan','benq','bird','blac',
                
'blaz','brew','cell','cldc','cmd-','dang','doco','eric','hipt','inno',
                
'ipaq','java','jigs','kddi','keji','leno','lg-c','lg-d','lg-g','lge-',
                
'maui','maxo','midp','mits','mmef','mobi','mot-','moto','mwbp','nec-',
                
'newt','noki','palm','pana','pant','phil','play','port','prox',
                
'qwap','sage','sams','sany','sch-','sec-','send','seri','sgh-','shar',
                
'sie-','siem','smal','smar','sony','sph-','symb','t-mo','teli','tim-',
                
'tosh','tsm-','upg1','upsi','vk-v','voda','wap-','wapa','wapi','wapp',
                
'wapr','webc','winw','xda ','xda-');

        if (
detectRequester('bot'))
                { return 
0; }

        if (
detectRequester('mobile'))
                { return 
7; }

        if (
preg_match('/(up.browser|up.link|mmp|symbian|smartphone|midp|wap|phone|ipad|android)/i',
                
$user_agent))
                { return 
1; }   #

        
if (strpos(strtolower($_SERVER['HTTP_ACCEPT']),'application/vnd.wap.xhtml+xml') > 0)
                { return 
2; }

        if (isset(
$_SERVER['HTTP_X_WAP_PROFILE']))
                { return 
3; }

        if (isset(
$_SERVER['HTTP_PROFILE']))
                { return 
4; }

        if (
in_array($mobile_ua,$mobile_agents))
                { return 
5; }

        if (
$screenWidth 600)
                { return 
6; }

        return 
0;
        }

?>