Looking For Multi Link Php redirect script.

iprofit

Banned
Nov 21, 2009
106
0
0
New York
Hey im looking for a script that will redirect to multiple links using one url, Just like a php redirect script would do just i want to be able to add 4 urls adn they redirect evenly between the 4 urls. Searched Google for a bit and have yet to find one.
 


Code:
<?php

$keyword = $_GET['keyword'];

//links
$destlink1 = 'http://my-P202-domain.com/tracking202/redirect/dl.php?t202id=11143&t202kw=' . $keyword;
$destlink2 = 'http://my-P202-domain.com/tracking202/redirect/dl.php?t202id=61159&t202kw=' . $keyword;
$destlink3 = 'http://my-P202-domain.com/tracking202/redirect/dl.php?t202id=14143&t202kw=' . $keyword;
$destlink4 = 'http://my-P202-domain.com/tracking202/redirect/dl.php?t202id=11943&t202kw=' . $keyword;


$randNum = rand(1 , 4);
if ($randNum == 1){
    header("Location: $destlink1");
} elseif ($randNum == 2){
    header("Location: $destlink2");
} elseif ($randNum == 3){
    header("Location: $destlink3");
} else {
    header("Location: $destlink4");
}
exit();
?>
 
[high='php']
<?php

$links = array('http://www.link1.com',
'http://www.link2.com',
'http://www.link3.com');

$randNum = rand(0, count($links));
header("Location: " . $links[$randNum]);

?>
[/high]

Just a bit easier to manage, add links and go.
 
<?php

$links = array('http://www.link1.com',
'http://www.link2.com',
'http://www.link3.com');

$randNum = rand(0, count($links));
header("Location: " . $links[$randNum]);

?>

Just a bit easier to manage, add links and go.



Ayy thanks as well both are great, second one is alot easier both will work.

Rep Added!