<?php
session_start();
$user_ID=$_SESSION[user_ID];
if (!$user_ID || $user_ID=='0')
{
header('location: index.php');
die('Login failed');
}
require("util.php");
$sql = new MySQL_class;
$sql->Create("generator");
$esql = new MySQL_class;
$esql->Create("generator");
if ($_GET[user]) { $_SESSION[var_user] = $_GET[user]; }
$user=$_SESSION[var_user];
?>
<?php
$sql->QueryItem("SELECT user.username as F497, user.password as F498, user.special as F499, user.type as F500 FROM `user` WHERE user.user='$user'");
$username = htmlspecialchars($sql->data['F497']);
$password = htmlspecialchars($sql->data['F498']);
$special = htmlspecialchars($sql->data['F499']);
$type = htmlspecialchars($sql->data['F500']);
if ($_POST['user']!='') {
$username = htmlspecialchars($_POST['username']);
$password = htmlspecialchars($_POST['password']);
$special = htmlspecialchars($_POST['special']);
$type = htmlspecialchars($_POST['type']);
}
?>
<html>
<head>
<link href="list.css" type="text/css" rel=stylesheet>
<meta content="text/css" http-equiv="Content-Style-Type">
<title>Edit User</title>
<script>
function confirmDelete(delUrl) {
if (confirm("Remove User?")) {
document.location = delUrl;
}
}
</script>
</head>
<body class="top" onload="document.Edit.<?php
if ($_POST[FOCUS]==499) {echo 'type';}
else {echo 'username';}
?>.focus();">
<form name="Edit" action="postedituser.php" method="post">
<input type=hidden name="FOCUS" value="">
<?php echo("<input type=hidden name=\"user\" size=5 value=\"$user\">\n");?>
<table class=enter>
<tr id=title><th colspan=2>Edit User</th></tr>
<tr><th>Username</th>
<td>
<?php echo("<input type=text name=\"username\" size=40 value=\"$username\">");?>
</td></tr>
<tr><th>Password</th>
<td>
<?php echo("<input type=text name=\"password\" size=40 value=\"$password\">");?>
</td></tr>
<tr><th>Special</th>
<td>
<?php
echo ("<select name=\"special\" OnChange=\"Edit.action=''; Edit.FOCUS.value='499'; Edit.submit();\">");
if ($special=='none') {
echo "<option value=\"none\" selected>none</option>\n";
} else {
echo "<option value=\"none\">none</option>\n";
}
if ($special=='admin') {
echo "<option value=\"admin\" selected>admin</option>\n";
} else {
echo "<option value=\"admin\">admin</option>\n";
}
if ($special=='sysadmin') {
echo "<option value=\"sysadmin\" selected>sysadmin</option>\n";
} else {
echo "<option value=\"sysadmin\">sysadmin</option>\n";
}
echo "</select>";
?>
</td></tr>
<tr><th>Type</th>
<td>
<?php
echo ("<select name=\"type\" OnChange=\"Edit.action=''; Edit.FOCUS.value='500'; Edit.submit();\">");
if ($type=='user') {
echo "<option value=\"user\" selected>user</option>\n";
} else {
echo "<option value=\"user\">user</option>\n";
}
if ($type=='group') {
echo "<option value=\"group\" selected>group</option>\n";
} else {
echo "<option value=\"group\">group</option>\n";
}
if ($type=='both') {
echo "<option value=\"both\" selected>both</option>\n";
} else {
echo "<option value=\"both\">both</option>\n";
}
if ($type=='cancelled') {
echo "<option value=\"cancelled\" selected>cancelled</option>\n";
} else {
echo "<option value=\"cancelled\">cancelled</option>\n";
}
echo "</select>";
?>
</td></tr>
</table>
<p id=buttons>
<input type=submit value=Change>
<?php
$test=true;
if ($test) {
echo "<input type=button value=Delete onClick=\"confirmDelete('postdeleteuser.php?user=$user&user=$user')\">\n";
}
?>
<input type=button value="Cancel" onClick="window.close()">
</p>
</form>
</body>
</html>