[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

[MacPerl] timeout script



Recently I have been working on a web based email program using
MacPerl...

Here's a couple of routines that do what you have asked...

Assume that whenever the user logins or checks another page, the routine
&logtime is called, updating their 3 minutes...then use the following
code to check their time before allowing the
routine &do_your_thing to be called

################## check time

$sam_time=time();

open (LOG, "$log_file");

 @time=<LOG>;
 foreach $line (@time){
 if ($line ne ""){
 $last_good_time=$line;}

close(LOG);}

###
if ($sam_time <= $last_good_time+180){

&do_your_thing; ######it's all good!!!
} else {
&noentry("2");}   ########logtime expired!!!!


########

sub logtime

{
$dirname=":mail:$_[0]";

$log_file="$dirname:"."log";

$sam_time=time();

open(LOGTIME, ">$log_file");

print LOGTIME "$sam_time\n";

close(LOGTIME);
}


#####PEACE OUT!!!!

Samuel Daffner

***** Want to unsubscribe from this list?
***** Send mail with body "unsubscribe" to mac-perl-request@iis.ee.ethz.ch