*/ $settings['display_type'] = 1; /* Allow on-the-fly settings override? 0 = NO, 1 = YES */ $settings['allow_otf'] = 1; /******************************************************************************* * DO NOT EDIT BELOW... * * ...or at least make a backup before you do! *******************************************************************************/ /* Override type? */ if ($settings['allow_otf'] && isset($_GET['type'])) { $type = intval($_GET['type']); } else { $type = $settings['display_type']; } /* Override images folder? */ if ($settings['allow_otf'] && isset($_GET['folder'])) { $folder = htmlspecialchars(trim($_GET['folder'])); if (!is_dir($folder)) { $folder = $settings['img_folder']; } } else { $folder = $settings['img_folder']; } /* Make sure images fodler ends with an '/' */ if (substr($folder,-1) != '/') { $folder.='/'; } /* Get a list of all the image files */ $flist = array(); foreach($settings['img_ext'] as $ext) { $tmp = glob($folder.'*'.$ext); if (is_array($tmp)) { $flist = array_merge($flist,$tmp); } } /* If we have any images choose a random one, otherwise select the "noimg.gif" image */ if (count($flist)) { $src = $flist[array_rand($flist)]; } else { $src = 'noimg.gif'; } /* Output the image according to the selected type */ if ($type) { header('Location:'.$src); exit(); } else { echo $src; } ?>

Duck hunt