Can someone check my PHP for me please - Double Meta Refresh Script

6 replies
Hey

I have a double meta refersh in php to blank out the referer.

But if the referer is not blank by the time it gets to the second page what happens?

Could someone fix it so if its not blank it goes back to first page etc.

here it is

1
===

<?php $id = $_GET["id"];

echo "<meta http-equiv=\"refresh\" content=\"0;url=http://www.website.com/redirect2/?id=$id\">";
?>

===

2
===

<?php $id = $_GET["id"];

$referer = $_SERVER['HTTP_REFERER']; if($referer == "")
{
echo "<meta http-equiv=\"refresh\"content=\"0;url=www.affiliatelink .com\subid=$id\">";
}
?>


===

Also,

Is there a way to redirect it to different websites depending on location?

example.

If the offer im promoting only accepts US traffic is there a way for it to detect that its not US then send it through to the internation website etc.

Thanks everyone

Matthew
#check #double #meta #meta refresh #php #redirect #referer #refresh #script #tracking
  • Profile picture of the author zerofill
    <?php
    $id = $_GET['id'];
    $referer = $_SERVER['HTTP_REFERER'];

    if($referer == "") {
    header("Location: http://www.affiliatelink.com/subid=$id");
    } else {
    header("Location: http://www.website.com/redirect2/?id=$id");
    }
    ?>

    Why don't you do it something like that?

    And as far as telling if it is U.S. or another country...you will need to use some type of geotargeting

    Out of curiosity...where is the value for $id coming from if there is no referer? heh...have to have id somewhere in the querystring that is coming in...

    PHP codeblock BBcode is causing an error for some reason so had to just post it in the message.

    Technically you don't need the $id=$_GET either you could just do
    header("Location: http://www.affiliatelink.com/subid=" . $_GET['id']);
    Signature
    Serp Shaker
    The IM World Will Be Shaken to the Core!
    Join my list at: IMCool.Biz
    New Podcast --> podcast.imcool.biz
    {{ DiscussionBoard.errors[67006].message }}
    • Profile picture of the author Matthew Miele
      ah thanks for that Donald! going to try it out!

      The ID comes from my actuall url

      so like

      www.mysite.com/?id=keyword1

      So is the geotargeting something beond php? or something that you dont personal know?

      Thanks again
      {{ DiscussionBoard.errors[67033].message }}
      • Profile picture of the author zerofill
        Well...the geotargeting you can get databases of...I imagine there are webservices out there etc...that you could make soap or xml-rpc requests to...I think even google maps api might have some type of geotargeting in it. You can buy databases that are updated to...Then you are just doing a check by the IP to your database...A lot of them are friggin expensive though heh.

        Just doing a quick search I see one for $50 and $12 for updates...
        Geolocation and Online Fraud Prevention from MaxMind

        Now I don't know who they are so you would have to research them or look around...probably a free database somewhere of them. Just probably not as current.

        I never had any reason to do geotargeting...but it would be easy with a webservice or a database.
        Signature
        Serp Shaker
        The IM World Will Be Shaken to the Core!
        Join my list at: IMCool.Biz
        New Podcast --> podcast.imcool.biz
        {{ DiscussionBoard.errors[67057].message }}
      • Profile picture of the author zerofill
        Originally Posted by Matthew Miele View Post

        ah thanks for that Donald! going to try it out!

        The ID comes from my actuall url

        so like

        www.mysite.com/?id=keyword1

        So is the geotargeting something beond php? or something that you dont personal know?

        Thanks again
        I guess what I mean is...if there is no referer...that $id value is probably empty to heh...unless I am not understanding something here?

        I understand your passing it via url...but the Referer is always going to be your site...once someone clicks on your link with the id value in the query string. Once someone clicks a link the referer changes.

        I take that back...I mean the $id won't be empty...but the referer will always be the same...or are you putting this link on multiple sites you mean?

        Like AdWords etc...?
        Signature
        Serp Shaker
        The IM World Will Be Shaken to the Core!
        Join my list at: IMCool.Biz
        New Podcast --> podcast.imcool.biz
        {{ DiscussionBoard.errors[67068].message }}
        • Profile picture of the author zerofill
          Nevermind...I am having a bad day lol...

          I am guessing you are probably pushing that from PPC right? And then sending them on again from a redirect...having a duh moment.
          Signature
          Serp Shaker
          The IM World Will Be Shaken to the Core!
          Join my list at: IMCool.Biz
          New Podcast --> podcast.imcool.biz
          {{ DiscussionBoard.errors[67078].message }}

Trending Topics