PHP Code:
echo "Hello World!";
ok a banner rotator for files like this:
imagename|extension|
http://sponsorurl.com
for example:
advert1|gif|
http://www.disney.com
ok heres the code: (I coded it so it's not stolen as you may think)
PHP Code:
<?
$filepath="/path/to/your/file.dat";
$banner_url="http://url.com/banners/images";
$nb_banners=0;
$fo = fopen($filepath,"r");
while (!feof($fo))
{
$fo_array[$i] = fgets($fo,4096);
if ($fo_array[$i] != "")
$i++;
}
fclose($fo);
$nb_banners = $i - 1;
mt_srand(make_seed());
$randval = mt_rand(1,$nb_banners);
$result = explode("|",$fo_array[$randval]);
echo "<a target='_top' href='$result[2]'><img src='$banner_url/$result[0].$result[1]' border='1'></a>";
function make_seed() {
list($usec, $sec) = explode(' ', microtime());
return (float) $sec + ((float) $usec * 100000);
}
?>