php if statement help

Discussion in 'PHP' started by edual200, Apr 2, 2009.

  1. #1
    trying to display something if 3 differnt things dont equal

    already have a variable with a number, if $number < 2000 and Googlebot != the user agent and user doesnt not have a cookie then i want it to echo else i dont

    i dont know how to make my if statement :(
    <?php
    $expire=time()+60*60*24*1; setcookie("user", "Alex Porter", $expire);
    $useragent = $_SERVER['HTTP_USER_AGENT'];
    $google = “Googlebot”;
    if (strstr($useragent, $google)) {
    echo "this";
    }
    else
    {
    echo "";
    }
    ?>
     
    edual200, Apr 2, 2009 IP
  2. SmallPotatoes

    SmallPotatoes Peon

    Messages:
    1,321
    Likes Received:
    41
    Best Answers:
    0
    Trophy Points:
    0
    #2
    if (($i > 5) && ($j == 'hello') && (strstr($x, $y) !== false))
       echo "<p>The sun and moon and stars have converged.</p>";
    Code (markup):
     
    SmallPotatoes, Apr 2, 2009 IP
    edual200 likes this.
  3. ultrasonic

    ultrasonic Peon

    Messages:
    30
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #3
    if(($number < 2000) && (!strstr($useragent, “Googlebot”)) && (!IsSet($cookiename)){
    echo "this";
    }else{
    //dothisinstead
    }
     
    ultrasonic, Apr 3, 2009 IP
    edual200 likes this.