Skip to content

Instantly share code, notes, and snippets.

@jab416171
Created July 24, 2013 14:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jab416171/6070957 to your computer and use it in GitHub Desktop.
Save jab416171/6070957 to your computer and use it in GitHub Desktop.
<?php
$ua = $_SERVER["HTTP_USER_AGENT"];
/*
if(strpos($_SERVER["HTTP_HOST"],"kmobs")) {
header('Location: kmobsmod/index.php');
}
else */
if (strpos($ua,"Android")) {
header ('Location: index_android.php');
}
else if (strpos($ua,"iPod") || strpos($ua,"iPhone") || strpos($ua,"BlackBerry")) {
header ('Location: index_mobile.php');
}
else if (strpos($ua,"MSIE")) {
header ('Location: http://google.com/chrome/');
}
else {
header ('Location: index_desktop.php');
}
/*
IE: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; WOW64; Trident/4.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; InfoPath.2; .NET4.0C; .NET4.0E)
Chrome: Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US) AppleWebKit/534.10 (KHTML, like Gecko) Chrome/8.0.552.215 Safari/534.10
Firefox: Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.2.8) Gecko/20100722 Firefox/3.6.8
iPod Touch: Mozilla/5.0 (iPod; U; CPU iPhone OS 4_0 like Mac OS X; en-us) AppleWebKit/532.9 (KHTML, like Gecko) Version/4.0.5 Mobile/8A293
Android: Mozilla/5.0 (Linux; U; Android 2.2.1; en-us; Droid Build/FRG22D) AppleWebKit/533.1 (KHTML, like Gecko) Version/4.0 Mobile Safari/533.1
Blackberry: BlackBerry8530/5.0.0.973 Profile/MIDP-2.1 Configuration/CLDC-1.1 VendorID/105
*/
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment