<%@page contentType="text/html;charset=GBK"%>
<%@page import="java.sql.*"%>
<%@ include file="/public/checkvalidadmin.jsp"%>

<jsp:useBean id="conn" scope="page" class="test.ConnOracle"/>

<%!
ResultSet rs = null;
String username = "";
String password = "";
String priv_ok = "";
int priv = 0;
%>

<html>

<head>
	<title>权限管理</title>
	<link rel="stylesheet" href="../public/style.css">
</head>

<Body class="ss">
<center>
<%
priv_ok = (String)session.getAttribute("adminpriv");

if(priv_ok!=null && priv_ok.equals("8")) {

	rs = conn.executeQuery("select * from test_admin");
	if(!rs.next()) {
		out.println("数据库中还没有用户！<br>");
		out.println("单击这里<a href=javascript:history.back()>返回</a><br>");
	} else {
	%>

	<form action="privchange.jsp" method="post">
		<table bgColor="#acacff" border="1" borderColorDark="#ffffff" borderColorLight="#000000" cellSpacing="1" width="80%">
		<tr>
			<th width="25%">用户名</th>
			<th width="25%">密码</th>
			<th width="25%">面试权限</th>
			<th width="25%">管理权限</th>
		</tr>
		<%do {
			username = rs.getString("username");
			password = rs.getString("password");
			priv     = rs.getInt("PRIVILEDGE");
		%>
		<tr align="center">
			<td><%=username%></td>
			<td><%=password%></td>
			<%
				if(priv == 1 || priv == 8) {
			%>
				<td>
					<Input name="check1<%=username%>" type="checkbox" value="ok" checked>
				</td>
			<%
				}else {	
			%>
				<td>
					<Input name="check1<%=username%>"" type="checkbox" value="ok" >
				</td>
			<%
				}	
				if(priv == 8) {
			%>
				<td>
					<Input name="check2<%=password%>" type="checkbox" value="ok"  checked>
				</td>
			<%
				}else {	
			%>
				<td>
					<Input name="check2<%=password%>" type="checkbox" value="ok" >
				</td>
			<%
				}	
			%>

		</tr>
		<% } while(rs.next());%>
		<tr align="center">
			<td colspan="4">
				<Input type="submit" value="保存修改">&nbsp;&nbsp;&nbsp;&nbsp;
				<Input type="reset"  value="恢复">
			</td>
		</tr>
		</table>
<%
	}	
} else {
	out.println("对不起，您的权限不足！<br>");
	out.println("<a href=javascript:history.back()>单击这里返回</a><br>");
}
%>
</form>
</center>
</Body>

</html>