thanks for the grade ;-)
Ellandrd
Main Topics
Browse All TopicsThe following seems to work well... I would like to get expert opinion on if it's a good way to do it...
//If principal is using a Palm, then set it for presentation changes, etc.
$string = $_SERVER['HTTP_USER_AGENT'
$substring = 'Palm';
$pos = 0;
$pos = strpos($string, $substring, $pos);
if ($pos ==''){
$isPalm="0";
}
else {
$isPalm="1";
}
--------------------------
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
Hi Ellandrd,
Thanks for this super-useful reply! I hope you're still around and wouldn't mind answering a couple of follow-up newbie questions:
1. If I am using a CMS, where would I put the code? The CMS (Concrete5) delivers everything from a database to the index.php page.
2. What do I need to do to actually have it do the re-direct? I think this code just has placeholders...
if($mobile_browser > 0)
{
// is a mobile browser
}
else
{
// is not a mobile browser
Thanks so much!
Andrey
Business Accounts
Answer for Membership
by: ellandrdPosted on 2007-04-28 at 12:37:24ID: 18995143
This is a quick and easy way to detect mobile phones with PHP. Try this script that i use:
r|up.link| mmp|symbia n|smartpho ne|midp|wa p|phone|vo dafone|o2| pocket|mob ile|pda|ps p)/i',strt olower($_S ERVER['HTT P_USER_AGE NT'])))
ERVER['HTT P_ACCEPT'] ),'text/vn d.wap.wml' )>0) || (strpos(strtolower($_SERVE R['HTTP_AC CEPT']),'a pplication /vnd.wap.x html+xml') >0)) || ((isset($_SERVER['HTTP_X_W AP_PROFILE ']) || isset($_SERVER['HTTP_PROFI LE']))))
['HTTP_USE R_AGENT'], 0,4));
,'amoi','a udi','aste ','avan',' benq','bir d','blac', 'blaz','br ew','cell' ,'cldc','c md-','dang ','doco',' eric','hip t','inno', 'ipaq','ja va','jigs' ,'kddi','k eji','leno ','lg-c',' lg-d','lg- g','lge-', 'maui','ma xo','midp' ,'mits','m mef','mobi ','mot-',' moto','mwb p','nec-', 'newt','no ki','oper' ,'opwv','p alm','pana ','pant',' pdxg','phi l','play', 'pluc','po rt','prox' ,'qtek','q wap','sage ','sams',' sany','sch -','sec-', 'send','se ri','sgh-' ,'shar','s ie-','siem ','smal',' smar','son y','sph-', 'symb','t- mo','teli' ,'tim-','t osh','tsm- ','upg1',' upsi','vk- v','voda', 'wap-','wa pa','wapi' ,'wapp','w apr','webc ','winw',' winw','xda ','xda-');
bile_agent s))
<?php
$mobile_browser = '0';
if(preg_match('/(up.browse
{
$mobile_browser++;
}
if(((strpos(strtolower($_S
{
$mobile_browser++;
}
$mobile_ua = strtolower(substr($_SERVER
$mobile_agents = array('acs-','alav','alca'
if(in_array($mobile_ua,$mo
{
$mobile_browser++;
}
if($mobile_browser > 0)
{
// is a mobile browser
}
else
{
// is not a mobile browser
}
?>
ellandrd