|
michaellindahl
|
 |
« on: September 15, 2008, 07:37:29 AM » |
|
Hey I need some help,
When someone comes to my site, michaellindahl.com, If they are on a mobile device I want them to be redirected to mobile.michaellindahl.com, or michaellindahl.com/m/index.html, dont know which yet...
Thanks
|
|
|
|
|
Logged
|
|
|
|
|
Piotr GRD
|
 |
« Reply #1 on: September 15, 2008, 07:44:02 AM » |
|
I am not familiar at all with websites for mobiles, but I guess that they have different User Agent strings than "normal" browsers. If yes, then using PHP or .htaccess you can redirect them basing on some keywords in the User Agent string.
|
|
|
|
|
Logged
|
|
|
|
aed
Oh My Goddess
Hyper-Active Member
 
Offline
Posts: 130
-------------------
|
 |
« Reply #2 on: September 16, 2008, 11:33:51 AM » |
|
Here i use this code to detect if a user is using a mobile browser i just fount it in the net! function ismobile(){ // check if the user agent value claims to be windows but not windows mobile if(stristr($_SERVER['HTTP_USER_AGENT'],'windows')&&!stristr($_SERVER['HTTP_USER_AGENT'],'windows ce')){ return false; } // check if the user agent gives away any tell tale signs it's a mobile browser if(eregi('up.browser|up.link|windows ce|iemobile|mini|mmp|symbian|midp|wap|phone|pocket|mobile|pda|psp|N70|S60|S40|S80|S90',$_SERVER['HTTP_USER_AGENT'])){ return true; } // check the http accept header to see if wap.wml or wap.xhtml support is claimed if(stristr($_SERVER['HTTP_ACCEPT'],'text/vnd.wap.wml')||stristr($_SERVER['HTTP_ACCEPT'],'application/vnd.wap.xhtml+xml')){ return true; } // check if there are any tell tales signs it's a mobile device from the _server headers if(isset($_SERVER['HTTP_X_WAP_PROFILE'])||isset($_SERVER['HTTP_PROFILE'])||isset($_SERVER['X-OperaMini-Features'])||isset($_SERVER['UA-pixels'])){ return true; } // build an array with the first four characters from the most common mobile user agents $a = array( 'acs-'=>'acs-', 'alav'=>'alav', 'alca'=>'alca', 'amoi'=>'amoi', 'audi'=>'audi', 'aste'=>'aste', 'avan'=>'avan', 'benq'=>'benq', 'bird'=>'bird', 'blac'=>'blac', 'blaz'=>'blaz', 'brew'=>'brew', 'cell'=>'cell', 'cldc'=>'cldc', 'cmd-'=>'cmd-', 'dang'=>'dang', 'doco'=>'doco', 'eric'=>'eric', 'hipt'=>'hipt', 'inno'=>'inno', 'ipaq'=>'ipaq', 'java'=>'java', 'jigs'=>'jigs', 'kddi'=>'kddi', 'keji'=>'keji', 'leno'=>'leno', 'lg-c'=>'lg-c', 'lg-d'=>'lg-d', 'lg-g'=>'lg-g', 'lge-'=>'lge-', 'maui'=>'maui', 'maxo'=>'maxo', 'midp'=>'midp', 'mits'=>'mits', 'mmef'=>'mmef', 'mobi'=>'mobi', 'mot-'=>'mot-', 'moto'=>'moto', 'mwbp'=>'mwbp', 'nec-'=>'nec-', 'newt'=>'newt', 'noki'=>'noki', 'opwv'=>'opwv', 'palm'=>'palm', 'pana'=>'pana', 'pant'=>'pant', 'pdxg'=>'pdxg', 'phil'=>'phil', 'play'=>'play', 'pluc'=>'pluc', 'port'=>'port', 'prox'=>'prox', 'qtek'=>'qtek', 'qwap'=>'qwap', 'sage'=>'sage', 'sams'=>'sams', 'sany'=>'sany', 'sch-'=>'sch-', 'sec-'=>'sec-', 'send'=>'send', 'seri'=>'seri', 'sgh-'=>'sgh-', 'shar'=>'shar', 'sie-'=>'sie-', 'siem'=>'siem', 'smal'=>'smal', 'smar'=>'smar', 'sony'=>'sony', 'sph-'=>'sph-', 'symb'=>'symb', 't-mo'=>'t-mo', 'teli'=>'teli', 'tim-'=>'tim-', 'tosh'=>'tosh', 'treo'=>'treo', 'tsm-'=>'tsm-', 'upg1'=>'upg1', 'upsi'=>'upsi', 'vk-v'=>'vk-v', 'voda'=>'voda', 'wap-'=>'wap-', 'wapa'=>'wapa', 'wapi'=>'wapi', 'wapp'=>'wapp', 'wapr'=>'wapr', 'webc'=>'webc', 'winw'=>'winw', 'winw'=>'winw', 'xda-'=>'xda-' ); // check if the first four characters of the current user agent are set as a key in the array if(isset($a[substr($_SERVER['HTTP_USER_AGENT'],0,4)])){ return true; } }
|
|
|
|
|
Logged
|
|
|
|
|
michaellindahl
|
 |
« Reply #3 on: September 18, 2008, 11:36:48 AM » |
|
Here i use this code to detect if a user is using a mobile browser i just fount it in the net! Oh thanks! ...but where do I put it? before the body... I'm not very good at these html things...
|
|
|
|
|
Logged
|
|
|
|
|
Myles Grey
|
 |
« Reply #4 on: September 18, 2008, 12:04:13 PM » |
|
Wow, that's great aed, I really wanted a script like that. Okay, micaellindahl, create a file named ismobile.php, give it these contents: ismobile.php <?php function ismobile(){   // check if the user agent value claims to be windows but not windows mobile   if(stristr($_SERVER['HTTP_USER_AGENT'],'windows')&&!stristr($_SERVER['HTTP_USER_AGENT'],'windows ce')){     return false;   }   // check if the user agent gives away any tell tale signs it's a mobile browser   if(eregi('up.browser|up.link|windows ce|iemobile|mini|mmp|symbian|midp|wap|phone|pocket|mobile|pda|psp|N70|S60|S40|S80|S90',$_SERVER['HTTP_USER_AGENT'])){     return true;   }   // check the http accept header to see if wap.wml or wap.xhtml support is claimed   if(stristr($_SERVER['HTTP_ACCEPT'],'text/vnd.wap.wml')||stristr($_SERVER['HTTP_ACCEPT'],'application/vnd.wap.xhtml+xml')){     return true;   }   // check if there are any tell tales signs it's a mobile device from the _server headers   if(isset($_SERVER['HTTP_X_WAP_PROFILE'])||isset($_SERVER['HTTP_PROFILE'])||isset($_SERVER['X-OperaMini-Features'])||isset($_SERVER['UA-pixels'])){     return true;   }   // build an array with the first four characters from the most common mobile user agents   $a = array(                     'acs-'=>'acs-',                     'alav'=>'alav',                     'alca'=>'alca',                     'amoi'=>'amoi',                     'audi'=>'audi',                     'aste'=>'aste',                     'avan'=>'avan',                     'benq'=>'benq',                     'bird'=>'bird',                     'blac'=>'blac',                     'blaz'=>'blaz',                     'brew'=>'brew',                     'cell'=>'cell',                     'cldc'=>'cldc',                     'cmd-'=>'cmd-',                     'dang'=>'dang',                     'doco'=>'doco',                     'eric'=>'eric',                     'hipt'=>'hipt',                     'inno'=>'inno',                     'ipaq'=>'ipaq',                     'java'=>'java',                     'jigs'=>'jigs',                     'kddi'=>'kddi',                     'keji'=>'keji',                     'leno'=>'leno',                     'lg-c'=>'lg-c',                     'lg-d'=>'lg-d',                     'lg-g'=>'lg-g',                     'lge-'=>'lge-',                     'maui'=>'maui',                     'maxo'=>'maxo',                     'midp'=>'midp',                     'mits'=>'mits',                     'mmef'=>'mmef',                     'mobi'=>'mobi',                     'mot-'=>'mot-',                     'moto'=>'moto',                     'mwbp'=>'mwbp',                     'nec-'=>'nec-',                     'newt'=>'newt',                     'noki'=>'noki',                     'opwv'=>'opwv',                     'palm'=>'palm',                     'pana'=>'pana',                     'pant'=>'pant',                     'pdxg'=>'pdxg',                     'phil'=>'phil',                     'play'=>'play',                     'pluc'=>'pluc',                     'port'=>'port',                     'prox'=>'prox',                     'qtek'=>'qtek',                     'qwap'=>'qwap',                     'sage'=>'sage',                     'sams'=>'sams',                     'sany'=>'sany',                     'sch-'=>'sch-',                     'sec-'=>'sec-',                     'send'=>'send',                     'seri'=>'seri',                     'sgh-'=>'sgh-',                     'shar'=>'shar',                     'sie-'=>'sie-',                     'siem'=>'siem',                     'smal'=>'smal',                     'smar'=>'smar',                     'sony'=>'sony',                     'sph-'=>'sph-',                     'symb'=>'symb',                     't-mo'=>'t-mo',                     'teli'=>'teli',                     'tim-'=>'tim-',                     'tosh'=>'tosh',                     'treo'=>'treo',                     'tsm-'=>'tsm-',                     'upg1'=>'upg1',                     'upsi'=>'upsi',                     'vk-v'=>'vk-v',                     'voda'=>'voda',                     'wap-'=>'wap-',                     'wapa'=>'wapa',                     'wapi'=>'wapi',                     'wapp'=>'wapp',                     'wapr'=>'wapr',                     'webc'=>'webc',                     'winw'=>'winw',                     'winw'=>'winw',                     'xda-'=>'xda-'                   );   // check if the first four characters of the current user agent are set as a key in the array   if(isset($a[substr($_SERVER['HTTP_USER_AGENT'],0,4)])){     return true;   } } ?>
Then make it so that all of your regular pages have a .php extension, and put this at the top of them: e.g. index.php <?php require_once "ismobile.php"; if (ismobile() == true) { header("location: http://mobile.michaellindahl.com/") exit; } ?> <html> <heah><title>...</title><head> <body> <!-- normal HTML here --> </body> </html>
|
|
|
|
|
Logged
|
|
|
|
aed
Oh My Goddess
Hyper-Active Member
 
Offline
Posts: 130
-------------------
|
 |
« Reply #5 on: September 18, 2008, 05:49:01 PM » |
|
thats it Myles Grey thats exactly how i used it in my website....
Just put the code in top of every page or only in your main page because sometimes mobile users do like to view the Normal version of your site.
|
|
|
|
|
Logged
|
|
|
|
|
michaellindahl
|
 |
« Reply #6 on: September 19, 2008, 07:07:09 AM » |
|
Wow, that's great aed, I really wanted a script like that. Okay, micaellindahl, create a file named ismobile.php, give it these contents: ismobile.php
Then make it so that all of your regular pages have a .php extension, and put this at the top of them: e.g. index.php
Um one problem maybe, I am using HTML, and it doesn't seem to work, and cant/dont want to change... This is what the index.html file looks like... ?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <?php require_once "ismobile.php"; if (ismobile() == true) { header("location: http://mobile.michaellindahl.com/") exit; } ?> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title> </title> <meta http-equiv="refresh" content="0;url= mysite/welcome.html" /> <meta name="verify-v1" content="u0KtxmqUBERDONs+8ZALboe3RdTCQrcL71lOyF+yTkc=" /> </head> <body> </body> </html>
|
|
|
|
« Last Edit: September 19, 2008, 07:08:52 AM by michaellindahl »
|
Logged
|
|
|
|
|
codewhite
|
 |
« Reply #7 on: September 19, 2008, 07:17:42 AM » |
|
Um one problem maybe, I am using HTML, and it doesn't seem to work, and cant/dont want to change...
All you need to do is change the extension from .html to .php no other changes are required.
|
|
|
|
|
Logged
|
 I am a signature virus, copy me to your signature to spread me <Generation 0> Increase Generation number each time I'm copied. Codewhite Designs Cigar Journal On sale now.
|
|
|
|
michaellindahl
|
 |
« Reply #8 on: September 19, 2008, 07:25:28 AM » |
|
Um one problem maybe, I am using HTML, and it doesn't seem to work, and cant/dont want to change...
All you need to do is change the extension from .html to .php no other changes are required. It says this at michaellindahl.com Parse error: syntax error, unexpected T_STRING in /www/110mb.com/m/i/c/h/a/e/l/l/michaellindahl/htdocs/index.php on line 1
|
|
|
|
|
Logged
|
|
|
|
|
codewhite
|
 |
« Reply #9 on: September 19, 2008, 07:30:47 AM » |
|
Sorry, I missed the error in your code, you need to change ?xml version="1.0" encoding="UTF-8"?> to <?xml version="1.0" encoding="UTF-8"?>
|
|
|
|
|
Logged
|
 I am a signature virus, copy me to your signature to spread me <Generation 0> Increase Generation number each time I'm copied. Codewhite Designs Cigar Journal On sale now.
|
|
|
|
michaellindahl
|
 |
« Reply #10 on: September 19, 2008, 07:54:21 AM » |
|
Sorry, I missed the error in your code, you need to change
Sorry, I pasted incorrectly, it is that: <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <?php require_once "ismobile.php"; if (ismobile() == true) { header("location: http://mobile.michaellindahl.com/") exit; } ?> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title> </title> <meta http-equiv="refresh" content="0;url= mysite/welcome.html" /> <meta name="verify-v1" content="u0KtxmqUBERDONs+8ZALboe3RdTCQrcL71lOyF+yTkc=" /> </head> <body> </body> </html>
|
|
|
|
|
Logged
|
|
|
|
|
codewhite
|
 |
« Reply #11 on: September 19, 2008, 07:59:07 AM » |
|
In that case try just removing that line from the code, I'm not sure it's needed.
|
|
|
|
|
Logged
|
 I am a signature virus, copy me to your signature to spread me <Generation 0> Increase Generation number each time I'm copied. Codewhite Designs Cigar Journal On sale now.
|
|
|
|
michaellindahl
|
 |
« Reply #12 on: September 19, 2008, 08:19:35 AM » |
|
In that case try just removing that line from the code, I'm not sure it's needed.
Parse error: syntax error, unexpected T_STRING in /www/110mb.com/m/i/c/h/a/e/l/l/michaellindahl/htdocs/index.php on line 6 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <?php require_once "ismobile.php"; if (ismobile() == true) { header("location: http://mobile.michaellindahl.com/") exit; } ?> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title> </title> <meta http-equiv="refresh" content="0;url= mysite/welcome.html" /> <meta name="verify-v1" content="u0KtxmqUBERDONs+8ZALboe3RdTCQrcL71lOyF+yTkc=" /> </head> <body> </body> </html>
|
|
|
|
|
Logged
|
|
|
|
|
codewhite
|
 |
« Reply #13 on: September 19, 2008, 08:31:22 AM » |
|
Parse error: syntax error, unexpected T_STRING in /www/110mb.com/m/i/c/h/a/e/l/l/michaellindahl/htdocs/index.php on line 6 Ok, this is a two part fix, first at the end of the line header("location: http://mobile.michaellindahl.com/") you need to add ; header("location: http://mobile.michaellindahl.com/"); Second, open the ismobile.php file and replace all the   with a space. That should have things working for you.
|
|
|
|
|
Logged
|
 I am a signature virus, copy me to your signature to spread me <Generation 0> Increase Generation number each time I'm copied. Codewhite Designs Cigar Journal On sale now.
|
|
|
|
michaellindahl
|
 |
« Reply #14 on: September 19, 2008, 09:17:35 AM » |
|
Parse error: syntax error, unexpected T_STRING in /www/110mb.com/m/i/c/h/a/e/l/l/michaellindahl/htdocs/index.php on line 6 Ok, this is a two part fix, first at the end of the line header("location: http://mobile.michaellindahl.com/") you need to add ; header("location: http://mobile.michaellindahl.com/"); Second, open the ismobile.php file and replace all the   with a space. That should have things working for you. Nope!! go to michaellindahl.com to see the crazyness <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <?php require_once "ismobile.php"; if (ismobile() == true) { header("location: http://mobile.michaellindahl.com/"); exit; } ?> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title> </title> <meta http-equiv="refresh" content="0;url= mysite/welcome.html" /> <meta name="verify-v1" content="u0KtxmqUBERDONs+8ZALboe3RdTCQrcL71lOyF+yTkc=" /> </head> <body> </body> </html> function ismobile(){ // check if the user agent value claims to be windows but not windows mobile if(stristr($_SERVER['HTTP_USER_AGENT'],'windows')&&!stristr($_SERVER['HTTP_USER_AGENT'],'windows ce')){ return false; } // check if the user agent gives away any tell tale signs it's a mobile browser if(eregi('up.browser|up.link|windows ce|iemobile|mini|mmp|symbian|midp|wap|phone|pocket|mobile|pda|psp|N70|S60|S40|S80|S90',$_SERVER['HTTP_USER_AGENT'])){ return true; } // check the http accept header to see if wap.wml or wap.xhtml support is claimed if(stristr($_SERVER['HTTP_ACCEPT'],'text/vnd.wap.wml')||stristr($_SERVER['HTTP_ACCEPT'],'application/vnd.wap.xhtml+xml')){ return true; } // check if there are any tell tales signs it's a mobile device from the _server headers if(isset($_SERVER['HTTP_X_WAP_PROFILE'])||isset($_SERVER['HTTP_PROFILE'])||isset($_SERVER['X-OperaMini-Features'])||isset($_SERVER['UA-pixels'])){ return true; } // build an array with the first four characters from the most common mobile user agents $a = array( 'acs-'=>'acs-', 'alav'=>'alav', 'alca'=>'alca', 'amoi'=>'amoi', 'audi'=>'audi', 'aste'=>'aste', 'avan'=>'avan', 'benq'=>'benq', 'bird'=>'bird', 'blac'=>'blac', 'blaz'=>'blaz', 'brew'=>'brew', 'cell'=>'cell', 'cldc'=>'cldc', 'cmd-'=>'cmd-', 'dang'=>'dang', 'doco'=>'doco', 'eric'=>'eric', 'hipt'=>'hipt', 'inno'=>'inno', 'ipaq'=>'ipaq', 'java'=>'java', 'jigs'=>'jigs', 'kddi'=>'kddi', 'keji'=>'keji', 'leno'=>'leno', 'lg-c'=>'lg-c', 'lg-d'=>'lg-d', 'lg-g'=>'lg-g', 'lge-'=>'lge-', 'maui'=>'maui', 'maxo'=>'maxo', 'midp'=>'midp', 'mits'=>'mits', 'mmef'=>'mmef', 'mobi'=>'mobi', 'mot-'=>'mot-', 'moto'=>'moto', 'mwbp'=>'mwbp', 'nec-'=>'nec-', 'newt'=>'newt', 'noki'=>'noki', 'opwv'=>'opwv', 'palm'=>'palm', 'pana'=>'pana', 'pant'=>'pant', 'pdxg'=>'pdxg', 'phil'=>'phil', 'play'=>'play', 'pluc'=>'pluc', 'port'=>'port', 'prox'=>'prox', 'qtek'=>'qtek', 'qwap'=>'qwap', 'sage'=>'sage', 'sams'=>'sams', 'sany'=>'sany', 'sch-'=>'sch-', 'sec-'=>'sec-', 'send'=>'send', 'seri'=>'seri', 'sgh-'=>'sgh-', 'shar'=>'shar', 'sie-'=>'sie-', 'siem'=>'siem', 'smal'=>'smal', 'smar'=>'smar', 'sony'=>'sony', 'sph-'=>'sph-', 'symb'=>'symb', 't-mo'=>'t-mo', 'teli'=>'teli', 'tim-'=>'tim-', 'tosh'=>'tosh', 'treo'=>'treo', 'tsm-'=>'tsm-', 'upg1'=>'upg1', 'upsi'=>'upsi', 'vk-v'=>'vk-v', 'voda'=>'voda', 'wap-'=>'wap-', 'wapa'=>'wapa', 'wapi'=>'wapi', 'wapp'=>'wapp', 'wapr'=>'wapr', 'webc'=>'webc', 'winw'=>'winw', 'winw'=>'winw', 'xda-'=>'xda-' ); // check if the first four characters of the current user agent are set as a key in the array if(isset($a[substr($_SERVER['HTTP_USER_AGENT'],0,4)])){ return true; } }
|
|
|
|
|
Logged
|
|
|
|
|
codewhite
|
 |
« Reply #15 on: September 19, 2008, 09:36:19 AM » |
|
Sorry, forgot to add that you need <?php at the beginning of the ismobile.php file and ?> at the end.
edited to add:
and get rid of the Â's use notepad or similar to replace them with spaces.
|
|
|
|
|
Logged
|
 I am a signature virus, copy me to your signature to spread me <Generation 0> Increase Generation number each time I'm copied. Codewhite Designs Cigar Journal On sale now.
|
|
|
|
Myles Grey
|
 |
« Reply #16 on: September 19, 2008, 09:43:55 AM » |
|
If you still want the XML line at the top (Recommended), put this at the top: <?php echo "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"; ?>
The error is caused because shorthand PHP (<? ... ?>) is turned on, which means the XML is parsed as PHP.
|
|
|
|
|
Logged
|
|
|
|
|
michaellindahl
|
 |
« Reply #17 on: September 19, 2008, 10:14:52 AM » |
|
If you still want the XML line at the top (Recommended), put this at the top: <?php echo "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"; ?>
The error is caused because shorthand PHP (<? ... ?>) is turned on, which means the XML is parsed as PHP. Okay So it still gives me an error and this is what I have: <?php echo "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"; ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <?php require_once "ismobile.php"; if (ismobile() == true) { header("location: http://michaellindahl.com/m/"); exit; } ?> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title> </title> <meta http-equiv="refresh" content="0;url= mysite/welcome.html" /> <meta name="verify-v1" content="u0KtxmqUBERDONs+8ZALboe3RdTCQrcL71lOyF+yTkc=" /> </head> <body> </body> </html>
|
|
|
|
|
Logged
|
|
|
|
|
robleyd
|
 |
« Reply #18 on: September 19, 2008, 10:25:52 AM » |
|
The error is in ismobile.php, not your index.php. Show that script, exactly as it is on your site.
|
|
|
|
|
Logged
|
I once had a hard drive clunk-clicking Strange noises, weird sounds and tick-ticking I thought I would wait And procrastinate... But now all my data is missing -------------- dd, a dump, a data dump read a line from standard in $USER, the name I call my self make - a long long time to run .so a library that is shared .ko it's not the same as .so tee, a redirect with in and out and brings us back to dd d d d
|
|
|
|
michaellindahl
|
 |
« Reply #19 on: September 19, 2008, 10:29:44 AM » |
|
The error is in ismobile.php, not your index.php. Show that script, exactly as it is on your site.
<?php function ismobile(){ // check if the user agent value claims to be windows but not windows mobile if(stristr($_SERVER['HTTP_USER_AGENT'],'windows')&&!stristr($_SERVER['HTTP_USER_AGENT'],'windows ce')){ return false; } // check if the user agent gives away any tell tale signs it's a mobile browser if(eregi('up.browser|up.link|windows ce|iemobile|mini|mmp|symbian|midp|wap|phone|pocket|mobile|pda|psp|N70|S60|S40|S80|S90',$_SERVER['HTTP_USER_AGENT'])){ return true; } // check the http accept header to see if wap.wml or wap.xhtml support is claimed if(stristr($_SERVER['HTTP_ACCEPT'],'text/vnd.wap.wml')||stristr($_SERVER['HTTP_ACCEPT'],'application/vnd.wap.xhtml+xml')){ return true; } // check if there are any tell tales signs it's a mobile device from the _server headers if(isset($_SERVER['HTTP_X_WAP_PROFILE'])||isset($_SERVER['HTTP_PROFILE'])||isset($_SERVER['X-OperaMini-Features'])||isset($_SERVER['UA-pixels'])){ return true; } // build an array with the first four characters from the most common mobile user agents $a = array( 'acs-'=>'acs-', 'alav'=>'alav', 'alca'=>'alca', 'amoi'=>'amoi', 'audi'=>'audi', 'aste'=>'aste', 'avan'=>'avan', 'benq'=>'benq', 'bird'=>'bird', 'blac'=>'blac', 'blaz'=>'blaz', 'brew'=>'brew', 'cell'=>'cell', 'cldc'=>'cldc', 'cmd-'=>'cmd-', 'dang'=>'dang', 'doco'=>'doco', 'eric'=>'eric', 'hipt'=>'hipt', 'inno'=>'inno', 'ipaq'=>'ipaq', 'java'=>'java', 'jigs'=>'jigs', 'kddi'=>'kddi', 'keji'=>'keji', 'leno'=>'leno', 'lg-c'=>'lg-c', 'lg-d'=>'lg-d', 'lg-g'=>'lg-g', 'lge-'=>'lge-', 'maui'=>'maui', 'maxo'=>'maxo', 'midp'=>'midp', 'mits'=>'mits', 'mmef'=>'mmef', 'mobi'=>'mobi', 'mot-'=>'mot-', 'moto'=>'moto', 'mwbp'=>'mwbp', 'nec-'=>'nec-', 'newt'=>'newt', 'noki'=>'noki', 'opwv'=>'opwv', 'palm'=>'palm', 'pana'=>'pana', 'pant'=>'pant', 'pdxg'=>'pdxg', 'phil'=>'phil', 'play'=>'play', 'pluc'=>'pluc', 'port'=>'port', 'prox'=>'prox', 'qtek'=>'qtek', 'qwap'=>'qwap', 'sage'=>'sage', 'sams'=>'sams', 'sany'=>'sany', 'sch-'=>'sch-', 'sec-'=>'sec-', 'send'=>'send', 'seri'=>'seri', 'sgh-'=>'sgh-', 'shar'=>'shar', 'sie-'=>'sie-', 'siem'=>'siem', 'smal'=>'smal', 'smar'=>'smar', 'sony'=>'sony', 'sph-'=>'sph-', 'symb'=>'symb', 't-mo'=>'t-mo', 'teli'=>'teli', 'tim-'=>'tim-', 'tosh'=>'tosh', 'treo'=>'treo', 'tsm-'=>'tsm-', 'upg1'=>'upg1', 'upsi'=>'upsi', 'vk-v'=>'vk-v', 'voda'=>'voda', 'wap-'=>'wap-', 'wapa'=>'wapa', 'wapi'=>'wapi', 'wapp'=>'wapp', 'wapr'=>'wapr', 'webc'=>'webc', 'winw'=>'winw', 'winw'=>'winw', 'xda-'=>'xda-' ); // check if the first four characters of the current user agent are set as a key in the array if(isset($a[substr($_SERVER['HTTP_USER_AGENT'],0,4)])){ return true; } } ?>
|
|
|
|
|
Logged
|
|
|
|
|