Question : Browser detection problems

Hello. Im having problems with my browser detection code:

 
1:
2:
3:
4:
5:
6:
<?php
$detected = array('msie', 'firefox', 'safari', 'webkit', 'opera', 'netscape', 'konqueror', 'gecko');
preg_match_all( '#(?<browser>' . join('|', $detected) .
    ')[/ ]+(?<version>[0-9]+(?:\.[0-9]+)?)#', strtolower( $_SERVER[ 'HTTP_USER_AGENT ' ]), $browser );
if(!$browser['browser'][0]=='msie') ||  $browser['browser'][0]=='firefox' print('Please download Internet Explorer or Firefox browser');
?>


i want allow to enter the specific page only from firefox and ie. if there are other browsers i want to tell them to download this 2 browsers and not to display them a specified page. Im getting error in thos code using OR operator but if i use only one browser comparation it works. please help

Answer : Browser detection problems

hope this helps
1:
2:
3:
4:
5:
6:
<?php
$detected = array('msie', 'firefox', 'safari', 'webkit', 'opera', 'netscape', 'konqueror', 'gecko');
preg_match_all( '#(?<browser>' . join('|', $detected) .
    ')[/ ]+(?<version>[0-9]+(?:\.[0-9]+)?)#', strtolower( $_SERVER[ 'HTTP_USER_AGENT ' ]), $browser );
if(!($browser['browser'][0]=='msie' ||  $browser['browser'][0]=='firefox')) print('Please download Internet Explorer or Firefox browser');
?>
Random Solutions  
 
programming4us programming4us