View Single Post
Old 11-19-2008, 02:13 PM  
donborno
Confirmed User
 
Join Date: Jan 2007
Location: Vienna, Austria
Posts: 374
Actually I wrote something similar in JavaScript some time ago, here you go:
Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
	<title>Amazing MGP</title>
	<script type="text/javascript">
	function change_referral_code(old_code, new_code) {
		// fetch all links
		var links = document.getElementsByTagName('a');

		for (var i = 0; i < links.length; i++) {
			alert(links[i].href);
			links[i].href = links[i].href.replace(new RegExp(old_code), new_code);
		}
	}

	function change_all_referrals() {
		// If there is no referrer
		if ((document.referrer == null) || (document.referrer == "")) {
			change_referral_code('revid=11111', 'revid=22222');
			// ... add some more for other sponsors
		}
	}
	</script>
</head>
<body onload="change_all_referrals()">
	<h1>Amazing MGP</h1>

	<p>Here are some galleries for you:</p>
	<ul>
		<li><a href="http://www.pinkvisualhdgalleries.com/asp/008/01/vid?campaign=0&revid=11111&s=1">Gallery 1</a></li>
		<li><a href="http://www.pinkvisualhdgalleries.com/asp/010/01/vid?campaign=0&revid=11111&s=1">Gallery 2</a></li>
		<li><a href="http://www.pinkvisualhdgalleries.com/asp/020/01/vid?campaign=0&revid=11111&s=1">Gallery 3</a></li>
		<li><a href="http://www.pinkvisualhdgalleries.com/asp/028/01/vid?campaign=0&revid=11111&s=1">Gallery 4</a></li>
		<li><a href="http://www.pinkvisualhdgalleries.com/asp/030/01/vid?campaign=0&revid=11111&s=1">Gallery 5</a></li>
	</ul>
</body>
</html>
Didn't test it in real life

Last edited by donborno; 11-19-2008 at 02:16 PM..
donborno is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote