Ad Rotater

Discussion in 'Programming' started by logon2future, Feb 11, 2008.

  1. #1
    is thier any ad rotater script in php to rotate widgetbukcs,adbrite and tyroo free of cost
     
    logon2future, Feb 11, 2008 IP
  2. turbosatan

    turbosatan Well-Known Member

    Messages:
    957
    Likes Received:
    24
    Best Answers:
    0
    Trophy Points:
    135
    #2
    openads is a bit over the top for just that but it should do the job
     
    turbosatan, Feb 11, 2008 IP
  3. Possibility

    Possibility Peon

    Messages:
    350
    Likes Received:
    14
    Best Answers:
    0
    Trophy Points:
    0
    #3
    I've always liked phpAdsNew. It's extremely powerful, but also a pretty large script. But it has so many options you won't know what to do with yourself.
     
    Possibility, Feb 11, 2008 IP
  4. lephron

    lephron Active Member

    Messages:
    204
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    53
    #4
    Something simple like below would do the job:

    <?php
    $numOfAds = 5; /* put number of ads here */
    $ad = rand() % $numOfAds;

    if($ad == 0)
    {
    ?>
    Ad code here
    <?php
    }

    if($ad == 1)
    {
    ?>
    Ad code here
    <?php
    }

    ...
     
    lephron, Feb 11, 2008 IP
  5. Possibility

    Possibility Peon

    Messages:
    350
    Likes Received:
    14
    Best Answers:
    0
    Trophy Points:
    0
    #5
    lephron has a good idea. You could also put the ads in an array, get a random number from taking the array size, and display $array[randNum].
     
    Possibility, Feb 11, 2008 IP
  6. -NB-

    -NB- Peon

    Messages:
    153
    Likes Received:
    7
    Best Answers:
    0
    Trophy Points:
    0
    #6
    Good suggestions, by why not take it one step higher by placing ads into an sql database? Then you could easily just call it like so:
    <?php
    $sql = "SELECT * FROM `advertisements` ORDER BY RAND() LIMIT 1";
    $q = mysql_query($sql);
    $r = mysql_fetch_assoc($q);
    ?>
    PHP:
     
    -NB-, Feb 11, 2008 IP
  7. jasondavis

    jasondavis Peon

    Messages:
    41
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #7
    jasondavis, Feb 11, 2008 IP
  8. logon2future

    logon2future Notable Member

    Messages:
    1,354
    Likes Received:
    10
    Best Answers:
    0
    Trophy Points:
    235
    #8
    thanks for the help
     
    logon2future, Feb 11, 2008 IP
  9. Investor1

    Investor1 Well-Known Member

    Messages:
    950
    Likes Received:
    21
    Best Answers:
    0
    Trophy Points:
    125
    #9
    Investor1, Feb 12, 2008 IP
  10. Possibility

    Possibility Peon

    Messages:
    350
    Likes Received:
    14
    Best Answers:
    0
    Trophy Points:
    0
    #10
    This would be my top choice too, but he may not have access to a database or may not be familiar with working with them.
     
    Possibility, Feb 12, 2008 IP