SEVIZ Posted May 9, 2009 Share Posted May 9, 2009 Is there a way with php to detect if the user is on a normal web connection or a pda? I want to display a script in one way if via the normal web and another if they are coming from their pda. Basically one is a far more simple version. Thanks Link to comment https://forums.phpfreaks.com/topic/157487-solved-detect-if-on-web-or-pda/ Share on other sites More sharing options...
ILMV Posted May 9, 2009 Share Posted May 9, 2009 You will net to check the user agent: $_SERVER['HTTP_USER_AGENT'] This will contain the information of the browser the user is viewing your site from, have a play around, you will need to research what user agents belong to PDAs and what don't, a simple if statement will allow you to change the site theme. ILMV Link to comment https://forums.phpfreaks.com/topic/157487-solved-detect-if-on-web-or-pda/#findComment-830274 Share on other sites More sharing options...
SEVIZ Posted May 9, 2009 Author Share Posted May 9, 2009 Thanks. Looked a bit and found this: <? if ( stristr($ua, "Windows CE") or stristr($ua, "AvantGo") or stristr($ua,"Mazingo") or stristr($ua, "Mobile") or stristr($ua, "T68") or stristr($ua,"Syncalot") or stristr($ua, "Blazer") ) { $DEVICE_TYPE="MOBILE"; } if (isset($DEVICE_TYPE) and $DEVICE_TYPE=="MOBILE") { $location='mobile/index.php'; header ('Location: '.$location); exit; } ?> Should work great. Figured I would post it for anyone else looking for the same thing. Thanks again! Link to comment https://forums.phpfreaks.com/topic/157487-solved-detect-if-on-web-or-pda/#findComment-830275 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.