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

[MacPerl] 3 minute timeout...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 theroutine &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



Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit

>I am currently looking for a way to log off somebody from a restricted->access server after a length of time lasting a few minutes. 

>let him browse through the website's pages for a total of 3 minutes, after which the script would disconnect him.

Philippe:

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, daff@upward-bound.mills.edu

http://upward-bound.mills.edu/SDD/

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