<?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
if ($_POST['username']!='') {
$username = ($_POST['username']);
$password = ($_POST['password']);
$special = $_POST['special'];
$type = $_POST['type'];
}
?>
<html>
<head>
<link href="list.css" type="text/css" rel=stylesheet>
<meta content="text/css" http-equiv="Content-Style-Type">
<title>User add</title>
</head>
<body class="top" onload="Insert.<?php
if ($_POST[FOCUS]==499) {echo 'type';}
else {echo 'username';}
?>.focus();">
<form name="Insert" action="postadduser.php" method="post">
<input type=hidden name="FOCUS" value="">
<table class=enter>
<tr id=title><th colspan=2>User add</th></tr>
<tr><th>Username</th>
<td>
<?php
$current=($_POST['username']!='');
$strdefault = $_POST['username'];
echo "<input type=text name=\"username\" size=40 value=\"$strdefault\">";
?>
</td></tr>
<tr><th>Password</th>
<td>
<?php
$current=($_POST['password']!='');
$strdefault = $_POST['password'];
echo "<input type=text name=\"password\" size=40 value=\"$strdefault\">";
?>
</td></tr>
<tr><th>Special</th>
<td>
<?php
$current=($_POST['special']!='');
echo ("<select name=\"special\" OnChange=\"Insert.action=''; Insert.FOCUS.value='499'; Insert.submit();\">");
if ('none' == $_POST['special']) {$sel='selected ';} else {$sel='';};
echo "<option value=\"none\"$sel>none</option>\n";
if ('admin' == $_POST['special']) {$sel='selected ';} else {$sel='';};
echo "<option value=\"admin\"$sel>admin</option>\n";
if ('sysadmin' == $_POST['special']) {$sel='selected ';} else {$sel='';};
echo "<option value=\"sysadmin\"$sel>sysadmin</option>\n";
echo ("</select>");
?>
</td></tr>
<tr><th>Type</th>
<td>
<?php
$current=($_POST['type']!='');
echo ("<select name=\"type\" OnChange=\"Insert.action=''; Insert.FOCUS.value='500'; Insert.submit();\">");
if ('user' == $_POST['type']) {$sel='selected ';} else {$sel='';};
echo "<option value=\"user\"$sel>user</option>\n";
if ('group' == $_POST['type']) {$sel='selected ';} else {$sel='';};
echo "<option value=\"group\"$sel>group</option>\n";
if ('both' == $_POST['type']) {$sel='selected ';} else {$sel='';};
echo "<option value=\"both\"$sel>both</option>\n";
if ('cancelled' == $_POST['type']) {$sel='selected ';} else {$sel='';};
echo "<option value=\"cancelled\"$sel>cancelled</option>\n";
echo ("</select>");
?>
</td></tr>
</table>
<p id=buttons>
<input type=submit value=Add>
<input type=button value=Cancel onClick="window.close()">
</p>
</form>
</body>
</html>