Forum Moderators: coopster

Message Too Old, No Replies

if cookie & browser is NOT {.}

Simple conditional but not sure how to do is not operator on browser

         

JAB Creations

1:53 am on Jul 16, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Internet Explorer executes flash objects regardless of the fact that their layers (div) are set to hidden. This means Carl starts ranting off about his pool tearing...well anyway he starts speaking once the secret is unlocked on my site if you visit using IE. I need to be able to execute this script based off the cookie except when the browser is IE. I'm not exactly sure how to write php to say in English terms...

if (cookie >82 and is NOT IE) print $secret82

Right now this looks like it will print the variable (with the HTML code assigned to it) if the cookie is equal to or greater to 82 and the browser IS Internet explorer. I figure this shouldn't be too hard but I've been messing with it for about an hour now scratching me head. :)

if ($_COOKIE['counter']>82 ¦¦ preg_match("/MSIE/i", "$useragent")) print $secret82;

- John

PS - Oddly enough the regular script executes the print command without using { or } if anyone could explain that oddity by any chance? Thanks!

eelixduppy

2:28 am on Jul 16, 2006 (gmt 0)



How about this?

if ($_COOKIE['counter']>82 && ([url=http://www.php.net/strpos]strpos[/url]($useragent,"MSIE")=== FALSE)) print $secret82;

>>if anyone could explain that oddity by any chance?

If there is only one line after the if condition, there is no need for braces. More here [php.net]

Good luck!

JAB Creations

3:34 pm on Jul 16, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



WOOHOO! Thanks eelixduppy! Patron visitors using IE won't hear Carl repeating himself on every page. :)

eelixduppy

8:48 pm on Jul 16, 2006 (gmt 0)



You're Welcome! Glad to help. I'm sure Carl is happy too ;)

whoisgregg

4:05 pm on Jul 18, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Of course, now your savvy patron visitors will just google up "jab creations" and manually set their cookie to 83. ;)