Conditional statement using LIKE?

Discussion in 'PHP' started by ridesign, Mar 28, 2009.

  1. #1
    I have a if statement and I am having problem with the 2nd part (&& $refer XOR localhost),
    What I want is to execute the code if the referer is not any page on http://localhost.
    I thought I could use a %Like% statement like in mysql but do not think it exists in php.

    <?php 
    $refer = $_SERVER['HTTP_REFERER'];
    if((isset($_GET['a'])) && $refer XOR localhost ) {
    include 'newindex.php'; 
    } else {}?>
    
    PHP:
     
    ridesign, Mar 28, 2009 IP
  2. steelaz

    steelaz Peon

    Messages:
    47
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Try this:

    
    if ((isset($_GET['a'])) && !strpos($refer, 'localhost')) {
    
    PHP:
    it will execute if $_GET['a'] is set and $refer does not contain string 'localhost';
     
    steelaz, Mar 28, 2009 IP
    ridesign likes this.
  3. ridesign

    ridesign Peon

    Messages:
    294
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #3
    works great thanks :)
     
    ridesign, Mar 28, 2009 IP