#!/usr/bin/perl
use CGI qw(:standard);

print header();
print start_html(-title=>'Update Password',
		-bgcolor=>'#DD9999'),
	h1('Update Password');
# get the current password
dbmopen %passwordList, "order/password", 0666;
$adminLogin = param('adminLogin');
$adminPassword = param('adminPassword');
if ($adminLogin eq 'root') {
   if ($adminPassword ne 'cs301') {
      print "Illegal login or password.", end_html;
      exit();
   }
} elsif ($passwordList{$adminLogin} ne $adminPassword) {
      print "Illegal login or password.", end_html;
      exit();
}
# legal admin 
print "Correct Admin Password!<BR>\nCreating User Login and Password...<BR>\n";
$login = param('login');
$password = param('password');
print "login=$login, password=$password<BR>\n";
$passwordList{$login} = $password;
dbmclose %passwordList;
print "New Login and Password Created!\n", end_html;

