Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?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("Cache-Control: no-cache, must-revalidate, no-store");
- header('Location: '.$folder.$files[$rand]);
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement