php browser detection script

by "Donna M. Jaggard" <donna(at)arwen.org>

 Date:  Thu, 9 Nov 2000 22:23:32 -0800
 To:  hwg-techniques(at)hwg.org
  todo: View Thread, Original
Hello!

I have a php browser detection script at 
http://www.arwen.org/whistler.new/index.php ... what it's 
*supposed* to do is tell me if it's running Internet Explorer 
or something else. If it's running IE, it should spit out 
"ieindex.html" into the spot where the script is, and if not, 
it should spit out nsindex.html.

It works fine in Netscape, giving me nsindex.html. In 
Internet Explorer, it gives me the right line, but then 
refuses to give me anything after the script... I've viewed 
the source, and it just ends after the php output.

The script is as follows: 

<?

$boutput = array (
	"MSIE"		=> "ieindex.html",
	"Default"	=> "nsindex.html"
	);

while (list ($bkey, $bval) = each ($boutput)) {
	if (eregi($bkey, substr($HTTP_USER_AGENT, 
strpos($HTTP_USER_AGENT, "(")))) {
		echo $bval;
		exit();
	}
}
echo $boutput["Default"];
?>

...
Does anyone have any idea why this is going screwy on 
me? Sadly, I'm not a programmer and I didn't write the 
script myself, and I'm sort of at a loss.

Suggestions are welcome. :)

tia,
Donna

--
Donna M. Jaggard   |   http://www.arwen.org/
donna(at)arwen.org    |   http://www.web-goddess.net/
When asked to use the word 'horticulture' in a sentence:
"You can lead a horticulture but you can't 
make her think."          - Dorothy Parker

HWG hwg-techniques mailing list archives, maintained by Webmasters @ IWA

This page is part of a preserved archive of archives.hwg.org. The site is no longer active and its content is not maintained. For enquiries about this archive, write to archive(at)iwanet.org.