Forum Moderators: coopster
<?php
$iphone = strpos($_SERVER['HTTP_USER_AGENT'],"iPhone");
$android = strpos($_SERVER['HTTP_USER_AGENT'],"Android");
$palmpre = strpos($_SERVER['HTTP_USER_AGENT'],"webOS");
$berry = strpos($_SERVER['HTTP_USER_AGENT'],"BlackBerry");
$ipod = strpos($_SERVER['HTTP_USER_AGENT'],"iPod");
if ($iphone || $android || $palmpre || $ipod || $berry == true)
{
print '<link href="mobile.css" rel="stylesheet" type="text/css" />';
else
print '<link href="regular.css" rel="stylesheet" type="text/css" />';
/*header('Location: http://mobile.site.com/');
//OR
echo "<script>window.location='http://mobile.site.com'</script>";*/
}
?> if ($iphone || $android || $palmpre || $ipod || $berry == true)
{
print '<link href="mobile.css" rel="stylesheet" type="text/css" />';
else
print '<link href="regular.css" rel="stylesheet" type="text/css" />';
}
else (no matching if) inside of your if-then block, which I believe is a fatal error. if( something )
{
// code here
}
else
{
// other code here
}