You can use this for image rotation next to your adsense ads so when your visitors are browsing through your site they will se different image every time they refresh. It is pretty self explanatory how to use this I hope <?php $path_to_images = "images/"; // path to your images $default_img = "turtle.gif"; // image to display if directory listing fails function getRandomImage($path, $img) { if ( $list = getImagesList($path) ) { mt_srand( (double)microtime() * 1000000 ); $num = array_rand($list); $img = $list[$num]; } return $path . $img; } function getImagesList($path) { $ctr = 0; if ( $img_dir = @opendir($path) ) { while ( false !== ($img_file = readdir($img_dir)) ) { // can add checks for other image file types here if ( preg_match("/(\.gif|\.jpg)$/", $img_file) ) { $images[$ctr] = $img_file; $ctr++; } } closedir($img_dir); return $images; } return false; } ?> Code (markup):
With a little modifications you can use it for anything, but this one is for rotating images in specified folder. Next to the image you can have whatever you want
Without sounding like a total newb..where exactly would i insert your script? what directory/file if it's not too much of a bother.