Forum Moderators: coopster
$browser = $_SERVER['HTTP_USER_AGENT'];
$veiw1 = strpos($browser, 'MSIE');
$view2 = strpos($browser, 'Mac');
if($view1 === true && $view2 === true){//if the browser is IE mac
echo "Please use a diffent broser";
}
else{//if it's not
echo "";
}
thanks
electricocean
$browser = $_SERVER['HTTP_USER_AGENT'];
$veiw1 = strpos($browser, 'MSIE');
$view2 = strpos($browser, 'Mac');
if($view1 === true && $view2 === true){//if the browser is IE mac
echo "Please use a diffent broser";
}
else{//if it's not
echo "";
}
My Code:
$view = get_browser(null, true);
if($view[browser] == 'Mac MSIE'){//Stop IE MAC
} else{//All other browsers are lovable
}
Output:
Warning: get_browser(): browscap ini directive not set. in /usr/export/www/hosting/dkicks/index.php on line 28
Is there a way I can change the settings or something?
thanks,
electricocean
Your other code here works for me as long as I remove the 'Mac' part of it as I'm not using a Mac. Have you tried dumping the HTTP_USER_AGENT $_SERVER variable to your screen first to see what is in it?
If this is the code you are using, you need to change it to equality without type comparison as strpos will return the first position that the string starts in, which will be a number, not boolean true. Note the double equal signs instead (==) ...
if($view1 == true && $view2 == true){//if the browser is IE mac Resource:
[php.net...]