How to show a piece of simple html code when the user is using IE ?

Discussion in 'PHP' started by poseidon, Oct 11, 2007.

  1. #1
    I want to show simple html code say "Hello New Member" when the user is using IE and is browsing my website for the first time or second time, So I need to set a cookie as well. :)

    Any help will be highly appreciated.

    Regards
     
    poseidon, Oct 11, 2007 IP
  2. nico_swd

    nico_swd Prominent Member

    Messages:
    4,153
    Likes Received:
    344
    Best Answers:
    18
    Trophy Points:
    375
    #2
    
    <?php
    
    if (!isset($_COOKIE['ie']) AND preg_match('/MSIE/i', $_SERVER['HTTP_USER_AGENT']))
    {
        setcookie('ie', 1, strtotime('+1 Week'));
        
        ?>
    
            HTML Here
      
         <?php
    }
    
    ?>
    
    PHP:
     
    nico_swd, Oct 11, 2007 IP
  3. poseidon

    poseidon Banned

    Messages:
    4,356
    Likes Received:
    246
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Nico to the resuce again :) Looks perfect to me, will check in the night...

    In the past as well I had asked you Nico (and again asking you as than I had not got reply from you), do you work as a freelancer on php frameworks ? I have some interesting prepositions for you...
     
    poseidon, Oct 11, 2007 IP