Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

dmmcintyre3

macrumors 68020
Original poster
Mar 4, 2007
2,131
3
I have referral links that I want a way to randomly pick between the some for my bookmarks. (with a script of corse)

I would like to set a chance for each one to happen (like 25% 1 site 25% another site and 50% another) too.
 
You'd probably want to use PHP. To get the referrer URL use,
PHP:
$_SERVER['HTTP_REFERER']
For random picking you can use something like,

PHP:
$pick = rand(0, 100);
if ($pick <= 25) {
  header('Location: somepage.html');
}
else if ($pick <= 50) {
  header('Location: otherpage.html');
}
else {
  header('Location: lastpage.html');
}
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.