Results 1 to 6 of 6

Thread: PHP : Help

  1. #1
    Join Date
    Mar 2006
    Location
    Scotland
    Posts
    1,012
    Tokens
    175

    Latest Awards:

    Default PHP : Help

    How do I do do the random banner change as I'm needing it for my upcoming sites advert system


    You don't like me
    Chances are I don't like you.

  2. #2
    Join Date
    Mar 2006
    Location
    Manchester UK
    Posts
    195
    Tokens
    0

    Default

    PHP Code:
    <?php 
    srand
    microtime() * 1000000); 
    $advertise rand(1,3); 
     
    switch(
    $advertise

    case 
    $banner="URL"$url="Link"; break; 
    case 
    $banner="URL"$url="Link "; break; 
    case 
    $banner="URL"$url="Link"; break; 

    $display "<a href=\"$url\"> "
    $display.= "<img src=\"$banner\"  "
    $display.= "width=\"495\" height=\"80\" border=\"0\" >"
    $display.="</a>"
    echo(
    $display); 
    ?>
    Last edited by Encryptions!; 14-03-2006 at 08:32 PM.

  3. #3
    Join Date
    Aug 2004
    Location
    bristol
    Posts
    3,799
    Tokens
    0

    Latest Awards:

    Default

    I'll code you a JavaScript one, as then you don't need a host which supports PHP:

    Code:
    <script type="text/JavaScript">
    <!--Begin
    
    // Addresses of images
    var image_addresses = new Array('cat.gif','dog.gif');
    
    // Generate a random number
    var rand_num = Math.floor(Math.random()*image_addresses.length);
    
    function display_banner() {
     var build_image;
     // !! Build image
          build_tmp=document.createElement('img');
          build_tmp.src=image_addresses[rand_num];
          document.body.appendChild(build_tmp);
     // !! Image appended to body
    }
    
    display_banner();
    
    //-->
    </script>
    kinda quit.

  4. #4
    Join Date
    Aug 2005
    Location
    Tunbridge Wells, Kent
    Posts
    5,063
    Tokens
    1,624

    Latest Awards:

    Default

    Very nice Encryptions and Nets -Thumbs up- i could never create one my self
    Never argue with an idiot, he'll drag you down to his level, and beat you with experience.

    Quote Originally Posted by Recursion
    *oh trust me
    *I would NEVER go ATi
    And 15 mins later...
    Sapphire ATI Radeon HD 5850 1024MB GDDR5 PCI-Express Graphics Card £195.73 1 £195.73
    *ordered.

  5. #5
    Join Date
    Mar 2006
    Location
    Scotland
    Posts
    1,012
    Tokens
    175

    Latest Awards:

    Default

    Thanks guys I think i'll go with Nets as i'm not sure if my host has PHP enabled


    You don't like me
    Chances are I don't like you.

  6. #6
    Join Date
    Sep 2005
    Posts
    5,253
    Tokens
    3,625

    Latest Awards:

    Default

    Quote Originally Posted by Respect
    Thanks guys I think i'll go with Nets as i'm not sure if my host has PHP enabled
    Most Paid For Hosts Have PHP Support - otherwise people woudn't buy them.. but if its a free host, eg Piczo etc then it deffintly won't

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •