generate random links for display with this simple cgi perl new script great for text ads links cgi random link randon-link date added Jan 2013 #! /usr/local/bin/perl ############################################## ################################ # Random Link Vers ion 1.0 # # Copyright 1996 Matt Wrig ht mattw@scriptarchive.com # # Created 7/15/9 5 Last Modified 7/30/95 # # Scri pts Archive at: http://www.scriptarchive.com/ # ################################################################## ############ # COPYRIGHT NOTICE # # Copyright 1996 Matthew M. Wright All Rights Reserved. # # # # Random Link may be used and modified free of charge by anyone so long as # # this copyright notice and the comments above remain intact. By using this # # code you agree to indemnify Matthew M. Wright from any liability that # # might arise from it's use. # # # # Selling the code for this program without pr ior written consent is # # expressly forbidden. In other wor ds, please ask first before you try and # # make money off of my pro gram. # # # # Obta in permission before redistributing this software over the Internet or # # in any other medium. In all cases copyright and header must rem ain intact.# ######################################################## ###################### # Define Variables $linkfile = "/home/scrip tarchive/demos/links/database"; # Options $uselog = 1; # 1 = YES; 0 = NO $logfile = "/home/scriptarchive/demos/links/rand _log"; $date = `date +"%D"`; chop($date); # Done ############## ################################################################ op en (LINKS, "$linkfile"); srand(); # kick ran d $nlines=@file=; # inhale file & get # of lines print "Location: $file[int rand $nlines]\n\n"; # print a random line close (LINKS); if ($uselog eq '1') { open (LOG, ">>$logfile"); print LOG "$ENV{'REMOTE_HOST'} - [$date ]\n"; close (LOG); } exit;