|
|
|
random images on your 404
IMPORTANT: this is a php tutorial. So you'll need PHP on the server to be able to run this script. The bold text shows where you have to customize the script.
<?
$directory = "$DOCUMENT_ROOT/404s"; //where are your 404 images?
$handle = opendir($directory); // open the dir
while ($file = readdir ($handle))
{
if ($file != "." && $file != "..")
{$filecount++;}}
srand((double)microtime()*1000000);
$random = rand(1,10); // 10 is the amount of images
?>
<!-- show -->
<img src="<? echo $directory."/0".$random ?>.jpg" border="0">
|
|
1. Copy and paste that code wherever you want the random images to appear on your 404 page.
2. Create a directory called e.g. "404s" and put your images in.
3. Rename your images to 01.jpg, 02.jpg and so on.
3. If there are more than 10 images, please change the amount ($random = rand (1/numberofyourimages)).
4. Be sure that your 404 page has a .php ending and upload it.
Note: if your images are .gif you have to change the line:
<img src="<? echo $directory."/0".$random ?>.jpg" border="0">
to:
<img src="<? echo $directory."/0".$random ?>.gif" border="0">
I hope that works for you and if it doesn't, email for help at webmistress@404lounge.net.
<----// tutorials |
|