CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
Search Posts SEARCH
Who's Online WHO'S
Log in LOG

Home: Perl Programming Help: Beginner:
Opinions about time expiration script...



Mar 25, 2000, 10:44 PM

Post #1 of 2 (1964 views)
Opinions about time expiration script... Can't Post


I'd like some opinions on the best way I should write a script I'm working on. It is a membership script in which the members passwords will expire in 30 days.

I am planning to write epoch seconds to a file when they register. To expire I'll set up a cron job to compare the current time in epoch seconds to the one in the registration file.

Is this the best way to do it or is there a module or library I should be using?

Thanks in advance,



Mar 27, 2000, 3:56 PM

Post #2 of 2 (1964 views)
Re: Opinions about time expiration script... [In reply to] Can't Post

Not sure what you mean by epoch, and I'm not familiar with a module which would do it. A daily cron job should do it.

I would use an "expiry" date, calculated as current date/month plus one.

<BLOCKQUOTE><font size="1" face="Arial,Helvetica,sans serif">code:</font><HR>

($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time);
@months = (Jan,Feb,Mar,Apr,May,Jun,Jul,Aug,Sept,Oct,Nov,Dec);
$NextMonth = ($mon + 1) % 12; # use remainder so that it works in December too!
$Expiry = "@months[$NextMonth] $mday";

Then in the cron job, grep for the day and if the month is this month, delete em, suspend em or whatever...


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives