PDA

View Full Version : Php ad's Rotator



sunny_ag
08-04-2006, 03:23 PM
Create your own php Ad rotator in Notpad or dreamweaver.

In this tutorial you will be able to create a simple ads rotator.


<?php


// Load Document for the ads
$adfile = " ads.php";
$ads = array();


// one line per ad
$fh = fopen($adfile, "r");
while(!feof($fh)) {


$line = fgets($fh, 10000);
$line = trim($line);
if($line != "") {
$ads[] = $line;
}
}


// randomly selects ads
$num = count($ads);
$idx = rand(0, $num-1);


echo $ads[$idx];
?>

d773hf82jhf721hf