<?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[right]) { $_SESSION[var_right] = $_GET[right]; }
if ($_GET[field]) { $_SESSION[var_field] = $_GET[field]; }
$right=$_SESSION[var_right];
$field=$_SESSION[var_field];
?>
<?php
$sql->QueryItem("SELECT user_field.user as F505 FROM `user_field` WHERE user_field.field='$field' AND user_field.right='$right'");
$user = htmlspecialchars($sql->data['F505']);
if ($_POST['user_field']!='') {
$field = htmlspecialchars($_POST['field']);
$right = htmlspecialchars($_POST['right']);
$user = htmlspecialchars($_POST['user']);
}
?>
<html>
<head>
<link href="list.css" type="text/css" rel=stylesheet>
<meta content="text/css" http-equiv="Content-Style-Type">
<title>Edit User field</title>
<script>
function confirmDelete(delUrl) {
if (confirm("Remove User field?")) {
document.location = delUrl;
}
}
</script>
</head>
<body class="top" onload="document.Edit.<?php
{echo 'field';}
?>.focus();">
<form name="Edit" action="postedituser_field.php" method="post">
<input type=hidden name="FOCUS" value="">
<?php echo("<input type=hidden name=\"user_field\" size=5 value=\"$user_field\">\n");?>
<table class=enter>
<tr id=title><th colspan=2>Edit User field</th></tr>
<tr><th></th>
<td>
<?php echo("<input type=text name=\"field\" size=5 value=\"$field\">");?>
</td></tr>
<tr><th></th>
<td>
<?php echo("<input type=text name=\"right\" size=5 value=\"$right\">");?>
</td></tr>
<tr><th>User</th>
<td>
<?php
echo ("<select name=\"user\" style=\"width: 175px\" OnChange=\"Edit.action=''; Edit.FOCUS.value='505'; Edit.submit();\">");
$sql->Query("select `username`, `user` from `user` where (type='group' or type='both')");
for ($i = 0; $i < $sql->rows; $i++) {
$sql->Fetch($i);
$searchID = $sql->data[user];
$searchShow = $searchID;
echo "<option ";
if ($searchID == $user) {echo "selected ";};
echo "value=\"$searchID\">$searchShow";
echo "</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_field.php?user_field=$user_field&field=$field&right=$right')\">\n";
}
?>
<input type=button value="Cancel" onClick="window.close()">
</p>
</form>
</body>
</html>