okay, so i got this piece of script from a friend years ago, it simply put makes a random image appear from a list of url's.
now, what i would like to do is make this script automatically refresh at a given interval.
i don't want to have to make the entire page refresh to get the script going again, i just want the script to re-run itself at a specified interval.
i am completely lost as to how to do this! :-/
mike
======================================
#Variables:
$RandomTextFile = "../mainimages/Random-IMG.txt";
$BaseImgURL = "http://www.url.com/mainimages/";
#Options:
$UseLog = 0; # Use Log File ? 1 = YES; 0 = NO
$LogFile = "../mainimages/Random-Text-Log.txt";
srand(time);
open(LINKS,"$RandomTextFile") || &Error("Cannot Open Links File : $RandomTextFile, Error $!\n");
$NbLines = @IMGFile = <LINKS>;
close(LINKS);
$Url = $IMGFile[int rand $NbLines];
if ($UseLog) {
@date = localtime(time); $date[4]++; $date[5] += 1900;
$Time = "$date[4]/$date[3]/$date[5]";
open(LOG,">>$LogFile") || &Error("Cannot Write Log File : $LogFile, Error $!\n");
print LOG "[$Time] - $ENV{'REMOTE_HOST'} -> $Url\n";
close(LOG);
}
if ($Url =~ /^http:\/\//) {
print "Location: $Url\n\n";
} else {
print "Location: $BaseImgURL$Url\n\n";
}
sub Error {
my($ErrorText) = @_;
exit;
}
==================================