It looks like you're using an Ad Blocker.
Please white-list or disable AboveTopSecret.com in your ad-blocking tool.
Thank you.
Some features of ATS will be disabled while you continue to use an ad-blocker.
// --------------------- END CONFIGURATION -----------------------
// This variable will point to the image we're going to return. It is null or empty now
$img = null;
// If the folder path doesn't end with a slash then add the slash on the end
if (substr($folder,-1) != '/') [
$folder = $folder.'/';
]
if (isset($_GET['img'])) [
else [
$fileList = array();
$handle = opendir($folder);
while ( false !== ( $file = readdir($handle) ) ) [
$file_info = pathinfo($file);
if (
isset( $extList[ strtolower( $file_info['extension'] ) ] )
) [
$fileList[] = $file;
]
]
closedir($handle);
if (count($fileList) > 0) [
$imageNumber = time() % count($fileList);
$img = $folder.$fileList[$imageNumber];
]
]
if ($img!=null) [
$imageInfo = pathinfo($img);
$contentType = 'Content-type: '.$extList[ $imageInfo['extension'] ];
header ($contentType);
readfile($img);
] ]
<html>
<body>
<img src="image<?php echo rand(1,20) ?>.jpg">
</body>
</html>
AddType application/x-httpd-php .jpg .png
#!/usr/bin/perl
use CGI::Carp qw(fatalsToBrowser);
opendir AVDIR, "../img/" or die "Can't open rotateavatars directory: $!";
@avatars = grep !/^\.\.?$/, readdir AVDIR;
$file = $avatars[rand $#avatars + 1];
open AV, "../img/$file" or die "Can't open $file $!";
if ($file =~ /\.jpg$/) [
$type = "jpeg";
] else [
$type = "gif";
]
$filesize = read AV, $graphic, -s AV;
print "Content-type: image/$type\r\n";
print "Content-length: " . $filesize . "\r\n\r\n";
print $graphic;