Debt Consolidation - Debt Consolidation - Self Improvement Articles Directory - Find jobs - Credit Report

PDA

View Full Version : help me random-image.php code


1why
Jan 2nd 2007, 8:24 pm
Please help
-------------------------------------------------
a-image.gif
b-image.gif
c-image.gif
d-image.gif

I need to place <img src="random-image.php" > to other websites

so it can load x-image.gif (x can be a, b ,c or d)

need to work for IE and FF (browser)
-------------------------------------------------
Does any one know how to write the random-image.php code?

Thank you

nico_swd
Jan 3rd 2007, 12:58 am
<?php

$prefixes = range('a', 'd');
$image = $prefixes[array_rand($prefixes)] . '-image.gif';

header('Cache-Control: no-cache, must-revalidate');
header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
header('Content-type: image/gif');

readfile($image);

?>

Untested.

1why
Jan 3rd 2007, 4:44 am
Nico_swd,

It is very helpful.

Thank you

nico_swd
Jan 3rd 2007, 7:48 am
I just fixed a llittle typo, incase you didn't see it yet. :)