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

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

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

 



Tim
Deleted

Mar 25, 2000, 10:44 PM

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

Hi,

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,

Tim


kencl
User

Mar 27, 2000, 3:56 PM

Post #2 of 2 (752 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.

eg
<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";
</pre><HR></BLOCKQUOTE>

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