<?
/* randomly choose a URL and redirect the surfer when clicked.
Make the URL a javascript mouseover so that it is a blind
link so the person clicking will not see the result in the
browser status window */
// Process code to redirect
if($in != ""){
// Assigning urls to variable to link
if ($in == "rnd"){
$randomurls = array("http://www.google.com/",
"http://www.scriptschool.com/",
"http://www.xerorip.com/",
"http://www.tigerdirect.com/");
mt_srand(time()); // Setting Random Seed
$count = count($randomurls); // Count the urls
$number = mt_rand(0,$count); // Getting the random number
$in = $randomurls[$number]; // Picking URL from the random number
}
header("Location: $in"); // If no redirect variable is set (1st page open)
}
?>
<html>
<head>
<title>Week #8 BASIC ~ Lestat</title>
<link rel="stylesheet" type="text/css" href="/css/scriptskewl.css">
</head>
<body>
Click <a href="http://timslan.com/scriptskewl/week8/wk8basic.php?in=rnd"
onMouseOver="window.status='link'; return true;"
onMouseOut="window.status='';">here</a> for a random page Link
<pre>
</pre>
<br>
<iframe src='wk8basicsrc.php' width='100%' height='300'></iframe>
<br>
<a href='../index.html'>BACK</a>
</body>
</html>