Jump to content


 


Register a free account to unlock additional features at BleepingComputer.com
Welcome to BleepingComputer, a free community where people like yourself come together to discuss and learn how to use their computers. Using the site is easy and fun. As a guest, you can browse and view the various discussions in the forums, but can not create a new topic or reply to an existing one unless you are logged in. Other benefits of registering an account are subscribing to topics and forums, creating a blog, and having no ads shown anywhere on the site.


Click here to Register a free account now! or read our Welcome Guide to learn how to use this site.

Photo

Randomizing Signature Script


  • Please log in to reply
No replies to this topic

#1 nsb823

nsb823

  • Members
  • 30 posts
  • OFFLINE
  •  
  • Location:Fairhaven, MA
  • Local time:11:10 AM

Posted 27 February 2006 - 05:35 PM

To use this script you must have your own webhost with php enabled. Have a folder with all the your sigs and no other images. Then save this code as randomsig.php and upload it into your sig folder. To post it in your signature do this for example:
[IMG]http://www.yoursite.com/sigs/randomsig.php[/IMG]

<?php
 ob_start( 'ob_gzhandler' );
 srand( time() );
 $files = array();
 if ($dir = @opendir(".")) {
 while (($file = readdir($dir)) !== false) {
 if ( eregi( '.(jpg|jpeg|bmp|gif|png)$', $file ) ) {
 $files[] = $file;
 }
 }
 closedir($dir);
 }
 $file = $files[rand() % sizeof( $files )];
 if ( eregi( '.jpg$', $file ) ) { header( "Content-Type: image/jpeg" ); }
 else if ( eregi( '.gif$', $file ) ) { header( "Content-Type: image/gif" ); }
 else { header( "Content-Type: image/png" ); }
 header( "Content-Length: " . filesize( $file ) );
 readfile( $file );
 ?>


BC AdBot (Login to Remove)

 





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users