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

 

ReLoad

Keys


Functions

arraybrowsercolorcookiedatetimeDBdebugdeviceDSTequiverrorflagsfontformatgeo
holidayhtmlisjsonmathparsePHPprintsearchsortstringtabletexttracetype
VOTDweatherxml

Function  detectRequester   Lines 874-917 (43 lines)Added: 2014-09-20 file  utils.php   Last mod: Fri 2021-05-14 21:45:07

function detectRequester $type )
        {
#-k     device
#-      What's the type of device calling me?
#-d     9/20/14 - added

        
$user_agent strtolower $_SERVER['HTTP_USER_AGENT'] );
        if ( 
$type == 'bot' )
                {       
# matches popular bots (watchmouse|pingdom\.com are "uptime services")
                
if ( preg_match "/googlebot|adsbot|yahooseeker|yahoobot|msnbot|".
                                
"watchmouse|pingdom\.com|feedfetcher-google/"$user_agent ) )
                        {
                        return 
true;
                        }
                }
        else if ( 
$type == 'browser' )
                {       
# matches core browser types
                
if ( preg_match "/mozilla\/|opera\//"$user_agent ) )
                        {
                        return 
true;
                        }
                }
        else if ( 
$type == 'mobile' )
        {       
# matches popular mobile devices that have small screens and/or touch
                # inputs. Mobile devices have regional trends; some of these will have
                # varying popularity in Europe, Asia, and America detailed demographics
                # are unknown, and South America, the Pacific Islands, and Africa trends
                # might not be represented, here
                
if ( preg_match "/phone|iphone|itouch|ipod|symbian|android|".
                                
"htc_|htc-|palmos|blackberry|opera mini|iemobile|".
                                
"windows ce|nokia|fennec|hiptop|kindle|mot |mot-|webos\/|"."
                                samsung|sonyericsson|^sie-|nintendo/"
$user_agent ) )
                {       
# these are the most common
                        
return true;
                }
                else if ( 
preg_match "/mobile|pda;|avantgo|eudoraweb|minimo|netfront|".
                                        
"brew|teleca|lg;|lge |wap;| wap /"$user_agent ) )
                {       
# these are less common, and might not be worth checking
                        
return true;
                }
        }
        return 
false;
}

?>