#!/usr/bin/perl # Worksheets Main CGI # (c) 2001, by Andrew Cantino # *Not for public distribution* require 'parts.lib'; $thisScript = "$URLRoot/worksheets.cgi"; if ($in{'password'} eq "" || $in{'user'} eq "") { &showLogin; } else { unless (&correctUserPassword($in{'user'}, $in{'password'})) { &showLogin("Incorrect Password"); } unless (&isActive($in{'user'})) { &safedie("Sorry, $in{'user'} is currently disabled."); } } if (&CheckFile("$userDIR/$in{'user'}")) { &GetData("$userDIR/$in{'user'}"); $FILEDATA{'LastLogin'} = $date; &StoreData("$userDIR/$in{'user'}", 1); } else { &safedie("Unable to access the user file for $in{'user'}."); } $user = $in{'user'}; &varifyUser($user); $password = $in{'password'}; $worksheet = $in{'worksheet'}; $mode = $in{'mode'}; if ($mode eq "") { &showMenu; } elsif ($mode eq "startEditWorksheet") { &startEditWorksheet; } elsif ($mode eq "showChangeEmail") { &printHTMLHeader; &header("Change Password"); print "
\n"; &back; &footer; exit; } elsif ($mode eq "doChangeEmail") { if ($in{'email'} eq "") { &safedie("Please enter an e-mail address."); } unless (&varify($in{'email'}, 3)) { &safedie("Sorry, that is not a valid e-mail address."); } if (&CheckFile("$userDIR/$in{'user'}")) { &GetData("$userDIR/$in{'user'}"); $FILEDATA{'Email'} = $in{'email'}; &StoreData("$userDIR/$in{'user'}", 1); } else { &safedie("Unable to access the user file for $in{'user'}."); } &printHTMLHeader; &header("E-mail Address Changed"); print "Your e-mail address was changed...continue.\n"; &footer; exit; } elsif ($mode eq "showChangePassword") { &printHTMLHeader; &header("Change Password"); print "
\n"; &back; &footer; exit; } elsif ($mode eq "doChangePassword") { if ($in{'password1'} eq "" || $in{'password2'} eq "") { &safedie("Please fill in both password fields."); } if ($in{'password1'} ne $in{'password2'}) { &safedie("Those passwords do not match."); } if (&CheckFile("$userDIR/$in{'user'}")) { &GetData("$userDIR/$in{'user'}"); $FILEDATA{'Password'} = crypt($in{'password1'}, "ac"); &StoreData("$userDIR/$in{'user'}", 1); } else { &safedie("Unable to access the user file for $in{'user'}."); } &printHTMLHeader; &header("Password Changed"); print "Your password was changed...continue.\n"; &footer; exit; } elsif ($mode eq "reportBug") { &printHTMLHeader; &header("Report Bug"); print "
| $wsheet"; if (&isLockedWorksheet($wsheet)) { print " -- Locked | ["; print "Edit]"; print " | \n"; } } } } print " |
\n"; print "