A simple ad rotation program written in php, which uses a simple text file to revolve your ads. No need to get any databaseor CGI scripting. You canalso use this concept to revolve contents on your site.
(assume you have a ad whose code is "" and
you have a second ad whose code is "
Now to put these two inside the text file, you need to seperate them using ~ sign. like below:
~
*/
//opening the text file, if this line gives you error when compiling
//the code then you need to chmod 755 your text file
$fcontents = join ('', file ('textfile.txt'));
//Spliting contents of file by looking for ~ mark between codes
//and storing everything into an array.
$s_con = split("~",$fcontents);
//getting a random number which will be within the limit of the
//contents of the file, means if 5 different banners/ads then the number
//will be between 0-4 (total 5 )
$banner_no = (rand()%(count($s_con)-1));
//simple scho banner
echo $s_con[$banner_no];
?>