PDA

View Full Version : randomly pick a page with chance for the page to be picked?




dmmcintyre3
Jun 25, 2009, 01:39 AM
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.



angelwatt
Jun 25, 2009, 10:04 AM
You'd probably want to use PHP. To get the referrer URL use,
$_SERVER['HTTP_REFERER']
For random picking you can use something like,

$pick = rand(0, 100);
if ($pick <= 25) {
header('Location: somepage.html');
}
else if ($pick <= 50) {
header('Location: otherpage.html');
}
else {
header('Location: lastpage.html');
}