2 simple scripts

Discussion in 'PHP' started by w3bmaster, Nov 24, 2006.

Thread Status:
Not open for further replies.
  1. #1
    I need an alternating (image) script (that i will use for alternating banners on a site)

    Second one a posting article script with a simple control panel .

    Thanks in advance
     
    w3bmaster, Nov 24, 2006 IP
  2. Joshimitsu

    Joshimitsu Guest

    Messages:
    95
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #2
    
    $rand = rand(1,3);
    
    if ($rand == "1"){echo "banner 1";}
    if ($rand == "2"){echo "banner 2";}
    if ($rand == "3"){echo "banner 3";}
    
    
    PHP:
    Thats a simple one
     
    Joshimitsu, Nov 24, 2006 IP
  3. TwistMyArm

    TwistMyArm Peon

    Messages:
    931
    Likes Received:
    44
    Best Answers:
    0
    Trophy Points:
    0
    #3
    I appreciate that you may not want something quite as involved, but if you're looking to carry ads, you might want to look at PHPAdsNew (an open source ad server).
     
    TwistMyArm, Nov 24, 2006 IP
  4. tandac

    tandac Active Member

    Messages:
    337
    Likes Received:
    11
    Best Answers:
    0
    Trophy Points:
    58
    #4
    Here's one I use:

    <?php
            $files=glob("ads/*.txt");
            $picks= array_rand($files,1);
            include $files[$picks[0]];
    ?>
    Code (markup):
    Randomly pick's an ad file out of a directory and includes it on a page.

    It's a little better than the above approach.
     
    tandac, Nov 24, 2006 IP
Thread Status:
Not open for further replies.