relyt
02-26-2003, 01:53 AM
is there a php that changes an image......the main banner, say, every time the page is viewed?
|
||||
changeing image.....relyt 02-26-2003, 01:53 AM is there a php that changes an image......the main banner, say, every time the page is viewed? mouse 02-26-2003, 02:49 AM Yeah, I use this randomising script for a similar purpose:$array[200]; //--number of banners/images $elem = 0; $dirname = "images"; //--insert the name of the banner, in this example a file named "images" in the same directory as the rotation script $dh = opendir($dirname); while ($file = readdir($dh)) { if (!is_dir("$dirname/$file")) $array[$elem] = $file; $elem = $elem + 1; } srand((double)microtime() * 10000000); $rand_keys = array_rand($array); $temp = $array[$rand_keys]; header("Location: $dirname/$temp"); ?> Then just link as so: <img src="filename.php"/>. Ökii 02-26-2003, 10:57 AM well, array_rand was a new one for me, looks like that'll be quite useful. :) |
| |||
EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum