<?

#for the most part, every action here should redirect to some other page...
$result = "";	#fill this in for non-redirected output.

my $act = $request->get("action", "NONE");
if($act eq "acctpasswd") {
	my $aname = $request->getEscaped("name", "_");
	my $apass = $request->getEscaped("password", "");
	if($aname eq "_") {
		print "Missing name";
	} else {
		my $q;
		if($apass eq "") {
			#set the password to something that somebody could not likely guess
			$q = "UPDATE account SET password=MD5(unix_timestamp()) WHERE name='$aname'";
		} else {
			$q = "UPDATE account SET password=MD5('$apass') WHERE name='$aname'";
		}
		if(!$EQDB->query($q)) {
			$result = "Error in query.";
		} else {
			$request->redirect("account.html?name=$aname");
		}
	}
}

?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link rel="stylesheet" title="Default" href="main.css" type="text/css" />
</head>

<body>
<h2 align="center">Action Taken</h2>
<hr/>
<? print $result; ?>
</body>
</html>
