Forum Moderators: skibum

Message Too Old, No Replies

Anybody Know A PHP redirection script

to hide affiliate code

         

mikeH

12:33 pm on May 2, 2003 (gmt 0)

10+ Year Member



Hopefully it is free and uses a flat file database. Been looking around the normal places but can't find one. If Google are going after mouseover, I need it. Some help would be appreciated.

Drastic

3:23 pm on May 2, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



[webmasterworld.com...] post #28 by Istvan looks like the trick.

dmorison

3:53 pm on May 2, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



You could knock up something quick and dirty by having a text file full of your destination URLs, and create a redir.php which you call with redir.php?id=x where x is the line number containing the URL you want to redirect to. Then you just open the file, read that many lines, and send out a redirect...

redir.php:

<?php

$f = fopen("redir.txt","r");

for( $i=1 ; $i<=$id ; $i++ )
{
$destination = fgets($f);
}

header("Location: " . $destination);

exit();

?>

So, if for example you had...

redir.txt:

[webmasterworld.com...]
[google.com...]

Then,

redir.php?id=1

would redirect to Webmaster World, and

redir.php?id=2

would redirect to Google.

I haven't tested this, and you should probably throw some error checking in the mix too. Certainly check that $id is numeric and the right sort of magnitude.

Hope this helps!

AthlonInside

7:14 pm on May 2, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Try to use Meta Refresh instead of Header Location redirect because not all affiliate program could plant cookie with header redirect. I have tested it and so far I have encounter 1 affiliate where I header redirect will not plant the cookie.

So, don't take risk. Use meta refresh.

Do you have a lots of different URLs to generate? Try to use both MySQL and PHP.