Quote:
Originally posted by Rorschach
Assuming you're changing the links on a dynamically generated free hosted gallery, eg. you're changing the links on:
http://www.fhgdomain.com/fhg.php?id=cocksmoker
On fhg.php:
PHP Code:
<?php
// Extract the affiliate id from the url
$affiliate_id = $_GET['id'];
// Insert the affiliate id into the sponsor code
$link_url = "http://www.sponsordomain.com/clickthrough.php?id=$id";
// Print the modified url
print "<a href=\"$link_url\">Click here to check out this fucking amazing sponsor</a>";
?>
|
This is a very usefull script but I had to make a simple modifaction to get it to work. It should read as follows:
PHP Code:
<?php
// Extract the affiliate id from the url
$affiliate_id = $_GET['id'];
// Insert the affiliate id into the sponsor code
$link_url = "http://www.sponsordomain.com/clickthrough.php?id=$affiliate_id";
// Print the modified url
print "<a href=\"$link_url\">$link_url</a>";
?>
Note the change on this line:
$link_url = "http://www.sponsordomain.com/clickthrough.php?id=
$affiliate_id ";
Also if you want to use this script to insert codes into links from a form (so a reseller can insert his code and then have his ID insterted into all of your links, you can use the following:
PHP Code:
<?php
// Extract the affiliate id from the url
$affiliate_id = $_POST['id'];
// Insert the affiliate id into the sponsor code
$link_url = "http://www.sponsordomain.com/clickthrough.php?id=$affiliate_id";
// Print the modified url
print "<a href=\"$link_url\">$link_url</a>";
?>
I hope this helps.
This script can also serve as the basis for a POTD script using iframes.