Go Back   WarriorForum - Internet Marketing Forums > Warrior Support Forums > Programming Talk
Register Blogs FAQ Social Groups CalendarHelp Desk

Reply
 
LinkBack Thread Tools
Old 08-30-2008, 01:31 PM   #1
HyperActive Warrior
 
Join Date: Sep 2007
Location: , , United Kingdom.
Posts: 161
Thanks: 0
Thanked 0 Times in 0 Posts
Default Can someone check my PHP for me please - Double Meta Refresh Script

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
Matthew Miele is offline   Reply With Quote
Old 08-30-2008, 03:38 PM   #2
Donald VanFossen
War Room Member
 
zerofill's Avatar
 
Join Date: May 2008
Location: Upstate NY , USA.
Posts: 1,996
Thanks: 271
Thanked 354 Times in 173 Posts
Default Re: Can someone check my PHP for me please - Double Meta Refresh Script

<?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']);




Last edited by zerofill; 08-30-2008 at 03:43 PM.
zerofill is online now   Reply With Quote
Old 08-30-2008, 03:49 PM   #3
HyperActive Warrior
 
Join Date: Sep 2007
Location: , , United Kingdom.
Posts: 161
Thanks: 0
Thanked 0 Times in 0 Posts
Default Re: Can someone check my PHP for me please - Double Meta Refresh Script

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
Matthew Miele is offline   Reply With Quote
Old 08-30-2008, 04:03 PM   #4
Donald VanFossen
War Room Member
 
zerofill's Avatar
 
Join Date: May 2008
Location: Upstate NY , USA.
Posts: 1,996
Thanks: 271
Thanked 354 Times in 173 Posts
Default Re: Can someone check my PHP for me please - Double Meta Refresh Script

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.



zerofill is online now   Reply With Quote
Old 08-30-2008, 04:08 PM   #5
Donald VanFossen
War Room Member
 
zerofill's Avatar
 
Join Date: May 2008
Location: Upstate NY , USA.
Posts: 1,996
Thanks: 271
Thanked 354 Times in 173 Posts
Default Re: Can someone check my PHP for me please - Double Meta Refresh Script

Quote:
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...?




Last edited by zerofill; 08-30-2008 at 04:10 PM.
zerofill is online now   Reply With Quote
Old 08-30-2008, 04:12 PM   #6
Donald VanFossen
War Room Member
 
zerofill's Avatar
 
Join Date: May 2008
Location: Upstate NY , USA.
Posts: 1,996
Thanks: 271
Thanked 354 Times in 173 Posts
Default Re: Can someone check my PHP for me please - Double Meta Refresh Script

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.



zerofill is online now   Reply With Quote
Old 08-30-2008, 04:27 PM   #7
HyperActive Warrior
 
Join Date: Sep 2007
Location: , , United Kingdom.
Posts: 161
Thanks: 0
Thanked 0 Times in 0 Posts
Default Re: Can someone check my PHP for me please - Double Meta Refresh Script

haha

basically every page contains the GET code and every link contains $id. So the ID is always passed from page to page.

Even to the redirect page.

www.mysite.com/redirect1/?id=123

etc
Matthew Miele is offline   Reply With Quote
Reply

  WarriorForum - Internet Marketing Forums > Warrior Support Forums > Programming Talk

Tags
check, double, meta, meta refresh, php, redirect, referer, refresh, script, tracking

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off



All times are GMT -6. The time now is 03:28 PM.