Here is a suggestion if you can't use cron tab...This mod uses a SSI to run the script(this is in addition to the include call). The script runs everytime the page is accessed, but because it compares the current date against one stored in a txt file, it'll only pick a new site once a day.
Under $txtfile = '/path/to/sotd.txt';
Add $datefile = '/path/to/datefile.txt';
At the begining of the sub main add...
#Check the date to see if we need to pick a new site
$olddate = "1-Jan-2000"; # Makes sure there is a valide date to check
open (DATE, "<$datefile") or print "unable to open date file Reason: $!";
$olddate = <DATE>;
close DATE;
if ($date eq $olddate) { exit; }At the end of that same routine add...
if ($datecheck eq "1") {
open (DATE, ">$datefile") or print "unable to open logfile: $datefile. Reason: $!";
print DATE $date;
close DATE;Next create a empty datefile and make sure it is in the location you specified at the begining of the script. Last add an SSI call like the following on your home page, or which ever page already holds the include call. NOTE: for this mod to work you will need to make sure that your sotd.pl is NOT in a password protected directory or else you will get an include error.
If you have used widgetz verison, you will want to remove these two lines from the code or else they will print out on your home page.
print "ID: $rec{$db_key} Title: $rec{'Title'}\n";
This mod isn't fancy, but it works well. It's been working on my site for 2 weeks now with no problems and without any effort from me.
Good Luck,
Sheldon
------------------
webmaster@gottabounce.com
www.gottabounce.com
Under $txtfile = '/path/to/sotd.txt';
Add $datefile = '/path/to/datefile.txt';
At the begining of the sub main add...
Code:
my $date = &get_date; #Check the date to see if we need to pick a new site
$olddate = "1-Jan-2000"; # Makes sure there is a valide date to check
open (DATE, "<$datefile") or print "unable to open date file Reason: $!";
$olddate = <DATE>;
close DATE;
if ($date eq $olddate) { exit; }
Code:
# Sets the new date to the date file if ($datecheck eq "1") {
open (DATE, ">$datefile") or print "unable to open logfile: $datefile. Reason: $!";
print DATE $date;
close DATE;
Code:
<!--#exec cgi="/cgi-bin/links/sotd.pl" -->If you have used widgetz verison, you will want to remove these two lines from the code or else they will print out on your home page.
Code:
$ENV{'REQUEST_METHOD'} and print "Content-type: text/plain\n\n"; print "ID: $rec{$db_key} Title: $rec{'Title'}\n";
This mod isn't fancy, but it works well. It's been working on my site for 2 weeks now with no problems and without any effort from me.
Good Luck,
Sheldon
------------------
webmaster@gottabounce.com
www.gottabounce.com