1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

HELP NEEDED... very simple Double Meta Refresh but im getting parse error ... HELP

Discussion in 'PHP' started by louiehenri, Dec 14, 2011.

  1. #1
    This is a very simple redirect Double Meta Refresh to clear out the referrer but i'm getting a parse error...

    ticket.php

    <?php
    echo "<meta http-equiv=\"refresh\" content=\"0;url=http://domain/ticket1.php\">";
    ?>


    ticket1.php
    <?php
    $referer = $_SERVER['HTTP_REFERER'];
    if($referer == "")
    {
    echo "<meta http-equiv=\"refresh\" content=\"0;url=http://offer.com/SHrN">";
    }
    else
    {
    echo "<meta http-equiv=\"refresh\" content=\"0;url=http://google.com">";
    }
    ?>




    both files upload to public_html of my hosting....
     
    louiehenri, Dec 14, 2011 IP
  2. codecre8r

    codecre8r Well-Known Member

    Messages:
    148
    Likes Received:
    6
    Best Answers:
    0
    Trophy Points:
    128
    #2
    You are not escaping the last double quote at the end of your url= parameter.

    This should work in ticket1.php

    <?php
    $referer = $_SERVER['HTTP_REFERER'];
    if($referer == "")
    {
    echo "<meta http-equiv=\"refresh\" content=\"0;url=http://offer.com/SHrN\">";
    }
    else
    {
    echo "<meta http-equiv=\"refresh\" content=\"0;url=http://google.com\">";
    }
    ?>
    
    
    Code (markup):
     
    codecre8r, Dec 15, 2011 IP
  3. luckyguy354

    luckyguy354 Peon

    Messages:
    21
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    To prevent about escaping double-quote, I prefer use single quote on the outer, and double quote on the URL.

    For example:
    
    <?php
    echo '<meta http-equiv="refresh" content="0;url=your_url_here">';
    ?>
    
    Code (markup):
     
    luckyguy354, Dec 16, 2011 IP
  4. ryandanielt

    ryandanielt Well-Known Member

    Messages:
    1,797
    Likes Received:
    37
    Best Answers:
    0
    Trophy Points:
    185
    #4
    This should work fine now :)

    
    <?php
    $referer = $_SERVER['HTTP_REFERER'];
    
    if($referer) {
         echo '<meta http-equiv="refresh" content="0; url=http://offer.com/SHrN">';
    } else {
         echo '<meta http-equiv="refresh" content="0; url=http://google.com">';
    }
    ?>
    
    PHP:
     
    ryandanielt, Dec 16, 2011 IP