PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
Moderator: General Moderators
Mr Tech
Forum Contributor
Posts: 424 Joined: Tue Aug 10, 2004 3:08 am
Post
by Mr Tech » Mon May 09, 2005 11:04 pm
How do I detect whether the users browser is either IE 5.5+, Firefox 1.0+, Mozilla 1.3+ or Netscape 7+?
I cant find a script that does exactly this.
Vicious
Forum Contributor
Posts: 105 Joined: Fri Jun 20, 2003 12:40 pm
Post
by Vicious » Mon May 09, 2005 11:15 pm
Mr Tech
Forum Contributor
Posts: 424 Joined: Tue Aug 10, 2004 3:08 am
Post
by Mr Tech » Mon May 09, 2005 11:29 pm
Huh? I'm getting this:
Parse error: parse error, unexpected '[' in c:\program files\easyphp\www\wysiwyg\editor\test.php on line 2
SBro
Forum Commoner
Posts: 98 Joined: Tue Sep 30, 2003 10:06 pm
Post
by SBro » Mon May 09, 2005 11:34 pm
Mr Tech
Forum Contributor
Posts: 424 Joined: Tue Aug 10, 2004 3:08 am
Post
by Mr Tech » Mon May 09, 2005 11:42 pm
Thanks. OK, I'm getting this:
Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.7) Gecko/20050414 Firefox/1.0.3 StumbleUpon/1.9995
How do I get the info what I need out of that so I can tell if it is the browsers mentioned in my first post?
SBro
Forum Commoner
Posts: 98 Joined: Tue Sep 30, 2003 10:06 pm
Post
by SBro » Mon May 09, 2005 11:49 pm
Use a function such as strstr() to check if the browser you are looking for is contained in the string returned by $_SERVER['HTTP_USER_AGENT']