Not a Member Yet,
Click here to Register
How do you like the new design?






ID: 103
Viewed: 4610
Added: Apr 02, 2002
Version:
Snippet uploaded by: snippet
Written By: snippet
Demo: Sorry, no demo



User Rated at: 4 Stars4 Stars4 Stars4 Stars
Rate This:

Thank you for your vote. Please wait...

It appears you already voted for this snippet

It appears your vote value was empty

This script will select an image at random
As long as the images are named with a number.
example: 1.gif, 2.gif

<!---Head--->
none

<!---Body--->


 <?
/*
|| @(#)randomimage.php v1.00 03 Mar 2002
||
|| Name: randomimage.php
|| Version: 1.00
|| Author: Snippet
|| WWW: http://www.snippetlibrary.com
||
|| =============== Conditions of Use =================
|| This file is free for distribution, modification
|| and reuse. It comes with no warranty expressed or
|| implied. Also you use it at your own risk and I'm
|| completely and utterly blameless for anything that
|| arises from that :)

|| This script will select an image at random
|| As long as the images are named with a number.
|| example: 1.gif, 2.gif
*/

// this is where you store you images.
$site = "http://www.yoursite.com/images";
// enter the max number of images you would like to select from.
$max = "2";


//**************
//don't change anything below unless you know what you are doing.
//**************

function random( $max )
{
srand ((double)microtime()*1000000);
$randval = rand(1,$max);
return $randval;
}

$r = random( $max );

if ($r == "0"){
$r = random( $max );
}
echo "<img src="$site/" . $r . ".gif" border="0" alt="">";

?>


No Comments to show

Please completely fill out the form below if you want to review this snippet. All reviews are subject to validation.


Replying to a Comment...


Adding your comment. Please wait...

Thanks for adding your comment!. After further review it will be added.

There was a problem adding your comment. Please try again.

Please complete all the fields in the form before sending.

© 2002 - 2017 snippetlibrary.com All Rights Reserved. Conditions