CODE
<?
//--------------------------------
// Random Image Script v2.0 by InvisionAdds(tm)
// Copyright 2003-2004 Chris Griego [cgriego]
// http://www.invisionadds.com/
$imgs = array(
//==============================
// Setup the information about our random images
//==============================
// Image Name and path
"/home/protocul/www/images/avatars/angel.gif",
"/home/protocul/www/images/avatars/chobits.gif",
"/home/protocul/www/images/avatars/get_backers.gif",
"/home/protocul/www/images/avatars/naruto00.gif",
"/home/protocul/www/images/avatars/naruto01.gif",
"/home/protocul/www/images/avatars/s_champloo.gif",
"/home/protocul/www/images/avatars/ah_my_goddess01.gif",
"/home/protocul/www/images/avatars/ah_my_goddess34.gif",
"/home/protocul/www/images/avatars/angel_sanctuary02.gif",
"/home/protocul/www/images/avatars/divers13.gif",
"/home/protocul/www/images/avatars/fma04.gif",
"/home/protocul/www/images/avatars/hellsing16.gif",
"/home/protocul/www/images/avatars/nurse_komugi04.gif",
"/home/protocul/www/images/avatars/nurse_komugi07.gif",
"/home/protocul/www/images/avatars/tenjou02.gif",
"/home/protocul/www/images/avatars/tenjou03.gif",
"/home/protocul/www/images/avatars/tenjou07.gif",
"/home/protocul/www/images/avatars/tenjou15.gif"
//==============================
// There is no need to edit anything below this line.
//==============================
);
// Seed the random number generator
$mtime = microtime();
$mtime = explode(' ', $mtime);
$mtime = $mtime[1] + $mtime[0];
srand($mtime);
// Find the total images
$imgs_total = count($imgs);
// Choose a random number from 0 to end of array
$random = rand(0, ($imgs_total - 1));
$content_type = "";
if (strtolower(substr($imgs[$random], -3)) == "gif")
{
$content_type = "image/gif";
} elseif (strtolower(substr($imgs[$random], -3)) == "png") {
$content_type = "image/png";
} elseif (strtolower(substr($imgs[$random], -3)) == "jpg" || strtolower(substr($imgs[$random], -4)) == "jpeg") {
$content_type = "image/jpeg";
} else {
// Error...
exit();
}
// Make sure the user is going to actually keep retreiving the image (an image in cache is not random)
@header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
@header("Cache-Control: no-cache, must-revalidate");
@header("Pragma: no-cache");
// Required, tells the browser what time of file we're sending it's way.
@header("Content-Type: ".$content_type);
// open the picture file
@readfile($imgs[$random]);
// End Random Image script
//--------------------------------
?>
//--------------------------------
// Random Image Script v2.0 by InvisionAdds(tm)
// Copyright 2003-2004 Chris Griego [cgriego]
// http://www.invisionadds.com/
$imgs = array(
//==============================
// Setup the information about our random images
//==============================
// Image Name and path
"/home/protocul/www/images/avatars/angel.gif",
"/home/protocul/www/images/avatars/chobits.gif",
"/home/protocul/www/images/avatars/get_backers.gif",
"/home/protocul/www/images/avatars/naruto00.gif",
"/home/protocul/www/images/avatars/naruto01.gif",
"/home/protocul/www/images/avatars/s_champloo.gif",
"/home/protocul/www/images/avatars/ah_my_goddess01.gif",
"/home/protocul/www/images/avatars/ah_my_goddess34.gif",
"/home/protocul/www/images/avatars/angel_sanctuary02.gif",
"/home/protocul/www/images/avatars/divers13.gif",
"/home/protocul/www/images/avatars/fma04.gif",
"/home/protocul/www/images/avatars/hellsing16.gif",
"/home/protocul/www/images/avatars/nurse_komugi04.gif",
"/home/protocul/www/images/avatars/nurse_komugi07.gif",
"/home/protocul/www/images/avatars/tenjou02.gif",
"/home/protocul/www/images/avatars/tenjou03.gif",
"/home/protocul/www/images/avatars/tenjou07.gif",
"/home/protocul/www/images/avatars/tenjou15.gif"
//==============================
// There is no need to edit anything below this line.
//==============================
);
// Seed the random number generator
$mtime = microtime();
$mtime = explode(' ', $mtime);
$mtime = $mtime[1] + $mtime[0];
srand($mtime);
// Find the total images
$imgs_total = count($imgs);
// Choose a random number from 0 to end of array
$random = rand(0, ($imgs_total - 1));
$content_type = "";
if (strtolower(substr($imgs[$random], -3)) == "gif")
{
$content_type = "image/gif";
} elseif (strtolower(substr($imgs[$random], -3)) == "png") {
$content_type = "image/png";
} elseif (strtolower(substr($imgs[$random], -3)) == "jpg" || strtolower(substr($imgs[$random], -4)) == "jpeg") {
$content_type = "image/jpeg";
} else {
// Error...
exit();
}
// Make sure the user is going to actually keep retreiving the image (an image in cache is not random)
@header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
@header("Cache-Control: no-cache, must-revalidate");
@header("Pragma: no-cache");
// Required, tells the browser what time of file we're sending it's way.
@header("Content-Type: ".$content_type);
// open the picture file
@readfile($imgs[$random]);
// End Random Image script
//--------------------------------
?>
