SEOMoz – Third-Party Affiliate Programs

The following is a translation of ASP code to PHP for the following SEOMoz post:
Third-Party Affiliate Programs: Roll Your Own Instead

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16

$AffiliateID = trim($_GET['affid']);
 
$CanonicalURL = $_SERVER['SERVER_NAME'] . $_SERVER['SCRIPT_NAME'];
 
if (strlen($AffiliateID) > 0) {
	$CanonicalURL = str_replace("&affid=" . $AffiliateID,"",$CanonicalURL);
	$CanonicalURL = str_replace("&affid=" . $AffiliateID,"",$CanonicalURL);
 
	setcookie("AffiliateID",$AffiliateID,time()+60*60*24*90);
}
?>
 
...
 
 echo $CanonicalURL; ?>" />

Similar Posts: