FRIHOSTFORUMSFAQTOSBLOGSDIRECTORY
You are invited to Log in or Register a Frihost Account!

Random Image Display

 


NG
Step 1
Open your favourite text editor and copy the code and save that file as random.php:


Code:
<?php

$random = "random.txt";

$fp = file($random);
srand((double)microtime()*1000000);
$rl = $fp[array_rand($fp)];
echo $rl;
?>



Step 2
Next you will need to make a file called random.txt and it should include something like this:


Code:
<a href="banner.php?id=banner1"><img src="banner1.gif" border="0"></a>
<a href="banner.php?id=banner2"><img src="banner2.gif" border="0"></a>




Upload all files to your site (the ones you want in the random display)

Then include random.php in your page where you want them to show up, a simple php include can do this:
Reply to topic    Frihost Forum Index -> Scripting -> Php and MySQL

FRIHOST HOME | FAQ | TOS | ABOUT US | CONTACT US | SITE MAP
© 2005-2007 Frihost, forums powered by phpBB.