Gossamer Forum
Home : Products : DBMan : Customization :

limiting records per user

Quote Reply
limiting records per user
i just installed the limit records from jpdeni with secure password lookup. i believe there is an error in the file that causes the password file to grow every time the user adds a record to database:

Code:
unless ($per_admin) {
open (PASS, "<$auth_pw_file") or &cgierr ("unable to open: $auth_pw_file.\nReason: $!");
if ($db_use_flock) { flock(PASS, 1); }
@lines = <PASS>;
close PASS; open (PASS, ">$auth_pw_file") or &cgierr ("unable to open: $auth_pw_file.\nReason: $!");
if ($db_use_flock) {
flock(PASS, 2) or &cgierr("unable to get exclusive lock on $auth_pw_file.\nReason: $!");
}
foreach $line (@lines) {
if ($line =~ /^$db_userid:/) {
chomp $line;
@passdata = split ':',$line;
--$passdata[3];
$per_add = $passdata[3];
$pass_line = join ':',@passdata;
print PASS "$pass_line\n";
print PASS "$pass_line\n"; # i think this line should be removed
}
else {
print PASS $line;
}
}
close PASS;
}