;
close PASSWD;
PASS: foreach $pass (@passwds) {
next PASS if ($pass =~ /^$/);
next PASS if ($pass =~ /^#/);
chomp ($pass);
($userid, $pw, $view, $add, $del, $mod, $admin, $email) = split (/:/, $pass);
$output .= "$userid:$pw:$view:$add:$del:$mod:0:$admin:$email\n";
}
open (PASS, ">$auth_pw_file") or &cgierr ("unable to open: $auth_pw_file.\nReason: $!");
print PASS $output;
close PASS;
print "Content-type: text/html\n\n";
print qq|Password file fixed
The password file is now fixed. Log on to DBMan to test it out.|;
sub cgierr {
# --------------------------------------------------------
# Displays any errors and prints out FORM and ENVIRONMENT
# information. Useful for debugging.
if (!$html_headers_printed) {
print "Content-type: text/html\n\n";
$html_headers_printed = 1;
}
print "\n\nCGI ERROR\n==========================================\n";
$_[0] and print "Error Message : $_[0]\n";
$0 and print "Script Location : $0\n";
$] and print "Perl Version : $]\n";
$db_setup and print "Setup File : $db_setup.cfg\n";
$db_userid and print "User ID : $db_userid\n";
$db_uid and print "Session ID : $db_uid\n";
print "\nForm Variables\n-------------------------------------------\n";
foreach $key (sort keys %in) {
my $space = " " x (20 - length($key));
print "$key$space: $in{$key}\n";
}
print "\nEnvironment Variables\n-------------------------------------------\n";
foreach $env (sort keys %ENV) {
my $space = " " x (20 - length($env));
print "$env$space: $ENV{$env}\n";
}
print "\n";
exit -1;
}
1;
# ------ The script ends above this line.-------------
# Upload the script (in ASCII mode) and set the permission to 755.
# Run it from your browser, using fixpass.cgi.
# After it's finished, log on to DBMan, using one of the
# username/password combinations that you know is in the file.
# Create a new user and try out all of the functions. Change one of
# the current users to "member" status and try out all the functions.
# (You may need to change a password so you'll be able to log in, but
# that's okay. You're not going to be using this file anyway when
# you're all done.)
# Test everything before you go on. Test it again. Test it a third
# time and then once more for good measure. Try to think of anything
# that might be a problem.
###################################################
# Step 6:
# Once you know that everything is working correctly, copy the
# following files from your test directory to your real directory:
#
# auth.pl
# .cfg
# db.cgi
# fixpass.cgi
#
# You may delete the other files in your test directory.
#
# After you replace the files in your real directory, remember to
# set the permission again for the fixpass.cgi file and run it. Once.
# After you run the script, delete the file from your directory.
####################################################
# Step 7:
# Now you can use the new permission. How you use it is up to you.
# If, for example, you are using the short/long display mod and you
# want only those with "member" permission to see the long display,
# edit your html.pl file as follows:
# In sub html_record, change
print qq|
$rec{'Title'}
|;
# to
if ($per_mem) {
print qq|
$rec{'Title'}
|;
}
else {
print qq|$rec{'Title'}|;
}
# And in sub html_view_success, change
if (($db_total_hits == 1) || ($maxhits == 1)) {
# to
if ((($db_total_hits == 1) || ($maxhits == 1)) && ($per_mem)) {
# If you have questions about how to use the permission to work the
# way you want, please post a question at the Gossamer Threads Support
# Forum at
# http://www.gossamer-threads.com/scripts/forum/forum.cgi