<?php
$folder = '';
$exts = 'jpg jpeg png gif';
$files = array(); $i = -1;
if ('' == $folder) $folder = './';
$handle = opendir($folder);
$exts = explode(' ', $exts);
while (false !== ($file = readdir($handle))) {
foreach($exts as $ext) {
if (preg_match('/\.'.$ext.'$/i', $file, $test)) {
$files[] = $file;
++$i;
}
}
}
closedir($handle);
mt_srand((double)microtime()*1000000);
$rand = mt_rand(0, $i);
header('Location: '.$folder.$files[$rand]);
?>
Whose that built by, thanks
If you have your own webhosting the you can rotate on any forum using a rotate.php file.
Code:<?php $folder = ''; $exts = 'jpg jpeg png gif'; $files = array(); $i = -1; if ('' == $folder) $folder = './'; $handle = opendir($folder); $exts = explode(' ', $exts); while (false !== ($file = readdir($handle))) { foreach($exts as $ext) { if (preg_match('/\.'.$ext.'$/i', $file, $test)) { $files[] = $file; ++$i; } } } closedir($handle); mt_srand((double)microtime()*1000000); $rand = mt_rand(0, $i); header('Location: '.$folder.$files[$rand]); ?>
Then just put your image files along with that as rotate.php in your folder on your web space and link to rotate.php as an image.
Easy...
$images = glob("{*.jpg,*.JPG,*.jpeg,*.JPEG,*.png,*.PNG}", GLOB_BRACE);
readfile($images[array_rand($images)]);
I can see you take that advice to heart... awesome set of sigs SkyfallMake sure you've got some good sigs to rotate.
Or you could do it in a couple of lines:
PHP:$images = glob("{*.jpg,*.JPG,*.jpeg,*.JPEG,*.png,*.PNG}", GLOB_BRACE); readfile($images[array_rand($images)]);