|
Not the cleanest most efficient code, but here
<?
$delim = "\n";
$cryfile = "random.txt";
$fp = fopen($cryfile, "r");
$contents = fread($fp, filesize($cryfile));
$cry_arr = explode($delim,$contents); fclose($fp); srand((double)microtime()*1000000);
$cry_index = (rand(1, sizeof($cry_arr)) - 1);
$herecry = $cry_arr[$cry_index];
echo $herecry . "\n";
?>
random.txt can contain any html.. complete on one line (no empty lines)
ie:
<a href="http://www.domain1.com"><img src="image1.jpg"></a>
<a href="http://www.domain2.com"><img src="image2.jpg"></a>
<a href="http://www.domain3.com"><img src="image3.jpg"></a>
<a href="http://www.domain4.com"><img src="image4.jpg"></a>
etc...
__________________
|