Kahuki Webmaster Forum  

Go Back   Kahuki Webmaster Forum > Website Development & Management > Programming

Programming Discussions related to web programming languages and other related issues.

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 02-25-2008, 06:49 AM
Rookie
 
Join Date: Dec 2007
Posts: 16
karola is on a distinguished road
Smile 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 displays trade show booths

Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


All times are GMT. The time now is 04:41 AM.


Powered by vBulletin® Version 3.7.2
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0