Need easy sample for random banners

Discussion in 'PHP' started by wardz, Aug 9, 2008.

  1. #1
    dear ....

    need help about sample script for random banners
    plz share for me ...
    i LOVE yOU ALL

    GBU
     
    wardz, Aug 9, 2008 IP
  2. nico_swd

    nico_swd Prominent Member

    Messages:
    4,153
    Likes Received:
    344
    Best Answers:
    18
    Trophy Points:
    375
    #2
    
    <?php
    $banners = glob('path/to/banners/*.jpg');
    $banner = $banners[array_rand($banners)];
    
    header('Content-Type: image/jpeg');
    readfile($banner);
    ?>
    
    PHP:
    I love you too!
     
    nico_swd, Aug 9, 2008 IP
  3. Crazy Man

    Crazy Man Peon

    Messages:
    139
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Thx, nico_swd very good.
     
    Crazy Man, Aug 9, 2008 IP
  4. wardz

    wardz Peon

    Messages:
    34
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #4
    and script with the URL target for event click on the banner please...

    waiting with love...
     
    wardz, Aug 9, 2008 IP
  5. blognol

    blognol Peon

    Messages:
    87
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #5
    you can get more scripts in javascriptkit.com
     
    blognol, Aug 10, 2008 IP
  6. SnoozZz

    SnoozZz Peon

    Messages:
    79
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #6
    http://snooz.mantis.0lx.net/b-upload/

    or

    <?php 
    
    $ban1 = "http://image url";
    $url1 = "http://link url"; 
    
    
    $randomNum = rand (1,6); //set this to the amount of banners
    
    //Select the banner of the random number
    $image = ${'ban'.$randomNum};
    
    //Url of the random number
    $url= ${'url'.$randomNum};
    
    //Prints out the link of the banner and the image of the banner
    Print "<a href=".$url." mce_href=".$url."><img src=".$image." border=0></a>";
    ?>
    
    PHP:
     
    SnoozZz, Aug 10, 2008 IP
  7. nico_swd

    nico_swd Prominent Member

    Messages:
    4,153
    Likes Received:
    344
    Best Answers:
    18
    Trophy Points:
    375
    #7
    Variable variables are ugly and should be avoided whenever possible. Use arrays...
     
    nico_swd, Aug 10, 2008 IP
  8. fliply

    fliply Peon

    Messages:
    61
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #8
    http://www.designplace.org/scripts.php?page=1&c_id=13

    http://smoothgallery.jondesign.net/getting-started/faq/

    http://simplythebest.net/scripts/DHTML_scripts/dhtml_images.html
     
    fliply, Aug 11, 2008 IP