Of course a more global example would be to use $_SERVER['HTTP_USER_AGENT']. This will output something like:
Mozilla/4.5 [en] (X11; U; Linux 2.2.9 i586)
It is possible to write a quick function to figure the browser:
<?php
function check_browser()
{
$browser = $_SERVER['HTTP_USER_AGENT'];
$browser = substr( $browser, 0, strpos($browser, '/') );
return $browser;
}
if( (check_browser() == 'MSIE') || (preg_match("@(MSIE[\s\d\.]*)\)@", check_browser()) )
{
// The die will kill this script, so nothing else will display
// Probably something a little more catered to you just in case
// you plan on doing other things in the same script, this kills it.
die('Sorry, I\'m anti-IE. You can\'t view my site with that browser.');
}
Something like that could work too if you can't point your php.ini to the browsercap settings....
HERE is an article on denying user access by user-agent in a .htaccess file. Much better than per-script.
~Brett