home *** CD-ROM | disk | FTP | other *** search
/ linuxmafia.com 2016 / linuxmafia.com.tar / linuxmafia.com / pub / linux / misc / sponsor_imgs.pl < prev    next >
Perl Script  |  2006-03-14  |  584b  |  23 lines

  1. #!/usr/bin/perl
  2.  
  3. $htmldir = "/home/httpd/html/";
  4. $imgdir = "images/sponsor_imgs/";   
  5. $countimgs = 0; 
  6.  
  7. opendir (SPONSORIMGS, "$htmldir$imgdir"); 
  8.  
  9. while (defined ($filename = readdir(SPONSORIMGS))) {  
  10.   if ($filename =~m/\.gif$/) {
  11.     $filename =~ s/\.gif//;
  12.     push(@images, $filename); 
  13.   }
  14.  
  15. closedir(SPONSORIMGS); 
  16.  
  17. $num = int(rand($#images + 1)); 
  18.  
  19. print "<a href=\"sponsors.shtml\#$images[$num]\"><img src=\"$imgdir$images[$num].gif\"  border=0 alt=\"We\'d like to thank our sponsors for making this website possible\.\" width=110 height=65 vspace=5 hspace=10></a>
  20. ";   
  21.  
  22.