SEO Forum
 
SEO Problems SEO Knowledge Database Seo Forum Search engine optimization
  FAQ   Search   Memberlist   Usergroups   Register   Profile   Log in to check your private messages   Log in 
PHP Tutorial - Ad Rotation Script

 
Post new topic   Reply to topic    Seo FORUM » Client Side Programming View previous topic :: View next topic  
PHP Tutorial - Ad Rotation Script
 PostPosted: Fri Feb 22, 2008 1:32 pm Reply with quote  
Message
  lpupo
Guest




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";
}

?>
_________________

Very Happy
 PostPosted: Mon Feb 25, 2008 6:47 am Reply with quote  
Message
  Martin Nordenso

Joined: 20 Feb 2008
Posts: 10

But the adv.text/banner didn't change automatically... It gets change only when I refresh the webpage....

I need something in which the banner text will automatically gets change after few seconds....

Anyhow I really appreciate your post....
Post new topic   Reply to topic    Searchenginegenie.com Forum Index » Client Side Programming

Page 1 of 1
All times are GMT

Display posts from previous:

  

Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Search Engine Optimization SEO Company