Try this.
if (preg_match("/MSIE/i", $browser ) && preg_match( "/Win/i", $browser ))
{
echo "you suck, you're using MSIE on Windows";
}
else
{
echo "congrats, you use a real browser";
}
You could try this as well:
if ( preg_match("/MSIE.*Win/i", $browser ) )
{
echo "you suck, you're using MSIE on Windows";
}
else
{
echo "congrats, you use a real browser";
}
You might actually find better help from this list:
http://www.php.net/mailing-lists.php
Questions like this come up many many times each day. I'm on the DB
list, but this question would be better posted on the "General user
list".
--Dave
On Fri, 2003-06-06 at 14:05, Wade Preston Shearer wrote:
> can anyone help my with this syntax?
>
> i'm trying to add a browser sniffer snippet (this isn't the real code)
> to my leech script (yes, the one that i have already posted a few times
> about)... that will do A if MSIE on windows, or B if anything else...
>
> it works to match one expression to $browser, but i need to match two
> parts of the expression (because there is more than on OS running MSIE
> and there is more than one browser on microsoft windows)...
>
>
>
> $browser = $_SERVER['HTTP_USER_AGENT'];
>
> if (preg_match("/MSIE/i" AND "/Win/i", "$browser"))
> {
> echo "you suck, you're using MSIE on Windows";
> }
> else
> {
> echo "congrats, you use a real browser";
> }
>
>
>
> ____________________
> BYU Unix Users Group
> http://uug.byu.edu/
> ___________________________________________________________________
> List Info: http://uug.byu.edu/cgi-bin/mailman/listinfo/uug-list
____________________
BYU Unix Users Group
http://uug.byu.edu/
___________________________________________________________________
List Info: http://uug.byu.edu/cgi-bin/mailman/listinfo/uug-list