View ¡m../sdba/././bin/./ACCESS_LIST.pl¡n
# ACCESS_LIST() - this checks the visitor's nick against # a plain text file, one nick to a line # returns nothing, but sets $Common::continue to true or false # if it is false error msg will be sent to visitor # (cause they arent in the access list) # All of these functions should start with package Common; # and end with the little 1; # $Common::continue - tells main script whether to stop # $Common::ERRORMSG - what to send back if visitor cant continue package Common; sub ACCESS_LIST { my ($list) = shift; if (!(-e $list)){ #default - if not set $list = "access.lst"; } open (AL, "impages/$list"); #none shall pass! my $inlist = 0; #is he in the access list? while (
) { $curline = $_; chomp $curline; $curline =~ s/ //g; $curline = lc($curline); #skip comments if ($curline !~ /^#/){ if ($curline eq $Common::VISITOR){ #they pass! $inlist = 1; } } } close AL; #set vars, do stuff if ($inlist){ $Common::continue =1; } else { $Common::continue =0; $Common::ERRORMSG = "You do not have permision to access this. ". "Please contact the administrator for access."; } } 1;