1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

PHP Ads Rotator

Discussion in 'Black Hat SEO' started by richarab, Oct 31, 2008.

  1. richarab

    richarab Junior Member

    Joined:
    Sep 18, 2008
    Messages:
    147
    Likes Received:
    21
    I have a website, I have an iframe on the website. I want to be able to rotate different ads/sites/ on the iframe. The Iframe redirects to a php file. I need to be able to place a shit load of ads into that file and have it rotate in my Iframe. can anyone help?
     
  2. roguehat

    roguehat Newbie

    Joined:
    Jun 24, 2008
    Messages:
    45
    Likes Received:
    16
    Edited By Moderator: Forum Promotion Not Allowed
     
    Last edited by a moderator: Oct 31, 2008
  3. paperchaser

    paperchaser Guest

    Heres a basic script I use. I'm currently looking for the more advanced one that can be scaled.

    PHP:
          <?php

          $number 
    rand(1,3);

           
     
          switch (
    $number){

                  case 
    1:

                          echo 
    ‘Adsense code';

                          break;

                  case 2:

                          echo â€˜Adbrite code'
    ;

                          break;

                  case 
    3:

                          echo 
    ‘Zango code';

                          break;
     
          }
      
          ?>
     
  4. BozoClown

    BozoClown Junior Member

    Joined:
    Jan 4, 2009
    Messages:
    150
    Likes Received:
    106
    Here is a quick one that should work for you. Place all your ads in a file called ads.txt with each ad separated by a string like ----- eg
    ads.txt
    Then the php file for your iframe should be as simple as this
    myads.php
    PHP:
    <?php
       $adsFileContents 
    file_get_contents('ads.txt');
       
    $ads explode('-----',$adsFileContents);
       echo 
    $ads[array_rand($ads)];
    ?>
     
  5. paperchaser

    paperchaser Guest

    Found it!!!!! This one can be scaled easily.

    PHP:
    <?php
    //Add as many links you want
    $mylink[1] = '<a href="http://www.pegor.com">Free PHP Tutorials</a>';
    $mylink[2] = '<a href="http://www.lifestinks.info">Fast Facebook Proxy</a>';
    $mylink[3] = '<a href="http://www.mozilla.org">Fastest and Secure Web Browser</a>';
    //$mylink[4] = .....
    //$mylink[5] = ....

    // this will count your links itself and select a random one
    $id rand(1,count($mylink));

    // this will display the random link
    echo $mylink[$id];
    ?>
     
  6. BozoClown

    BozoClown Junior Member

    Joined:
    Jan 4, 2009
    Messages:
    150
    Likes Received:
    106
    You could remove the little extra number keeping headache
    PHP:
    <?php
    //Add as many links you want
    $mylink[] = '<a href="http://www.pegor.com">Free PHP Tutorials</a>';
    $mylink[] = '<a href="http://www.lifestinks.info">Fast Facebook Proxy</a>';
    $mylink[] = '<a href="http://www.mozilla.org">Fastest and Secure Web Browser</a>';
    //$mylink[] = .....
    //$mylink[] = ....

    // this will display the random link
    echo $mylink[array_rand($mylink)];
    ?>
     
  7. BlackBeret

    BlackBeret Regular Member

    Joined:
    Jul 12, 2008
    Messages:
    257
    Likes Received:
    61
    Location:
    Transexual, Transylvania
    I notice these are text links, can you put in image links also?
     
  8. BozoClown

    BozoClown Junior Member

    Joined:
    Jan 4, 2009
    Messages:
    150
    Likes Received:
    106
    You can put anything inside the single quotes, including javascript.
     
  9. vikingrdave

    vikingrdave Newbie

    Joined:
    Oct 18, 2008
    Messages:
    6
    Likes Received:
    1
    couldn't you do it with openx as well?
     
  10. BozoClown

    BozoClown Junior Member

    Joined:
    Jan 4, 2009
    Messages:
    150
    Likes Received:
    106
    Yes you can, but I guess that would be too much for the OP to handle. When and if his needs ever require something like openx, his question will be different.
     
  11. econoimmeubles

    econoimmeubles Newbie

    Joined:
    May 7, 2013
    Messages:
    8
    Likes Received:
    0
    this can't be for kijiji
    you can't do this in paying sections they're good !