Jump to content

[SOLVED] Detect if on web or pda?


SEVIZ

Recommended Posts

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
Share on other sites

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
Share on other sites

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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.