View Single Post
Old 02-19-2008, 03:05 PM   #1 (permalink)
Rocko
 
Status: Junior Member
Join Date: Aug 2007
Posts: 17
Trader Rating: (0)
Rocko is on a distinguished road
TD$: 120.00
Donate
Default PHP Tutorial - Ad Rotation Script
With this script, you will be able to have 3 banners/ads in a rotation showing one more than the other.

First Banner we want it to display 70%.
Second Banner we want to display 20%.
Third Banner we want to display 10% .


Code:
<?php

// random number 1 - 100
$result_random=rand(1, 100);

// if result less than or equal 70, display ad 1 (70%)
if($result_random<=70){
echo "Ad 1 link";
}

// if result less than or equal 90, display ad 2 (20%)
elseif($result_random<=90){
echo "Ad 2 link";
}

// if result less than or equal 100, display ad 3 (10%)
elseif($result_random<=100){
echo "Ad 3 link";
}

?>
_________________
banner sign trade show display
Rocko is offline   Reply With Quote