Forum Moderators: coopster
if user-agent contains the letters IE, in uppercase and in that order, then img = IE.gif else img = notIE.gif
So basically my message is you dont have to work out each available user agent you can just set an image for one and a default one for everything else. The code would be dead simple. Although some browsers give the user the option to send user agent as though it were IE like opera, so that is something you need to consider. It depends on how important showing this image is to you.
[php.net...]
<?php
$a=$_SERVER['HTTP_USER_AGENT'];
if (preg_match('/IE/', $_SERVER['HTTP_USER_AGENT']) && (preg_match('/Opera/', $_SERVER['HTTP_USER_AGENT']))) {
$img="notIE.gif";
}
else
if (preg_match('/IE/', $_SERVER['HTTP_USER_AGENT'])) {
$img="IE.gif";
}
else
{$img="notIE.gif";}
?>
However with a script like this you would have to keep writing conditions everytime you find a browser that can spoof its user agent. This would be the same for anything taking its information from the http_user_agent environment variable.