WebSneak Webmaster Forums

home FAQ Members List search Quick Links

Go Back WebSneak Webmaster Forums » WebSneak MarketPlace » Services » Programming » PHP Tutorial - Ad Rotation Script  

Programming Place to look for programmers to complete your projects.

Reply
 

 

LinkBack Thread Tools Display Modes  
Old 02-19-2008, 07:18 AM   #1 (permalink)
Junior Member
 
Join Date: Aug 2007
Posts: 14
kutilo is on a distinguished road
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";
}

?>
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
kutilo is offline   Reply With Quote
Old 10-05-2008, 09:11 PM   #2 (permalink)
Junior Member
 
Join Date: Oct 2008
Posts: 3
a_kanna230 is on a distinguished road
Default Php

PHP is a computer scripting language. Originally designed for producing dynamic web pages, it has evolved to include a command line interface capability and can be used in standalone graphical applications.[2]

While PHP was originally created by Rasmus Lerdorf in 1995, the main implementation of PHP is now produced by The PHP Group and serves as the de facto standard for PHP as there is no formal specification.
__________________________________________________ ____

Sharp LCD TVs Videogiochi per la wii
a_kanna230 is offline   Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 
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
Forum Jump