different sig picture everytime u refresh

Discussion in 'Web Design & Coding' started by the_music_man, Dec 1, 2004.

  1. the_music_man

    the_music_man aka prodj88 =P

    Messages:
    2,401
    Location:
    USA
    hey you guys. i have a few penguin icons and i want it in my sig so that everytime u refresh its something different from the last time. so if anyone could tell me how this is done i would appreciate it. and will photobucket work or will i need something more advanced for my web host?
     
  2. On a few other forums I have mine so it does - what you need is a random image generator, which you just drop into the directory with the pictures you want in. However, you will need a proper host with php support, and this forum doesn't allow html in sig/avatar (both of which I have on rotating on some other forums).
     
  3. SPeedY_B

    SPeedY_B I may actually be insane.

    Messages:
    15,800
    Location:
    Midlands, England
    There was actually a post on how to do it once.. not sure where that's disspeared to :confused:
     
  4. Evil Marge

    Evil Marge I Rule Political User

    Messages:
    6,574
    Geffy used to do something like that didn't he??
     
  5. Khayman

    Khayman I'm sorry Hal... Political User Folding Team

    Messages:
    5,518
    Location:
    England
    you need some webspace which handles PHP, stick this code in a file called index.php and put it in a directory with your sigs, then link to that file in you sig
    Code:
    <?php
    ob_start( 'ob_gzhandler' );
    srand( time() );
    $files = array();
    if ($dir = @opendir(".")) {
    while (($file = readdir($dir)) !== false) {
    if ( eregi( '.(jpg|gif)$', $file ) ) {
    $files[] = $file;
    }
    } 
    closedir($dir);
    }
    $file = $files[rand() % sizeof( $files )];
    
    if ( eregi( '.jpg$', $file ) ) {
    header( "Content-Type: image/jpeg" );
    } else {
    header( "Content-Type: image/gif" );
    }
    header( "Content-Length: " . filesize( $file ) );
    readfile( $file );
    ?>