<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<% if session("admid")="" or Session("class")<>"1" then response.redirect"login.asp"%>
<!--#include file="conn.asp"-->
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>无标题文档</title>
<style type="text/css">
<!--
body,td,th {
	font-size: 12px;
}
-->
</style>
</head>
<body>
<%
  Select Case Request.querystring("action")
         case "adduser"
		    Set Rs=Server.CreateObject("adodb.recordset")
			Rs.Open "user",Conn,1,3
			Rs.addnew
			Rs("C_No")=request.Form("cno1")
			Rs("name")=request.Form("name1")
			Rs("password")=Request.Form("password1")
			Rs("username")=Request.Form("username1")
			rs("class")=request.Form("class1")
			Rs.update
			rs.close
			Set rs=nothing
			Response.Redirect("user.asp")
		Case "edituser"
		    Set Rs=Server.CreateObject("adodb.recordset")
			Rs.Open "select * from user where id="&cint(request.QueryString("id")),Conn,1,3
			Rs("C_No")=request.Form("cno")
			Rs("name")=request.Form("name")
			If Request.Form("xiugai")="1" then
			  Rs("password")=Request.Form("password")
			end If
			Rs("username")=Request.Form("username")
			rs("class")=request.Form("class")
			Rs.update
			rs.close
			Set rs=nothing
			Response.Redirect("user.asp")
		Case "del"
		    Conn.Execute("delete * from user where id="&cint(request.querystring("id")))
			Response.redirect("user.asp")
	    case "check"
		    Conn.Execute("update [user] set [check]=1 where id="&cint(request.QueryString("id")))
			Response.redirect("user.asp")		
		case "checked"
		    Conn.Execute("update [user] set [check]=0 where id="&cint(request.QueryString("id")))
			Response.redirect("user.asp")			
	   Case "add"				
%>
<table width="500" border="0" align="center" cellpadding="5" cellspacing="1" bgcolor="#006d63" style="border-collapse: collapse">
  <tr bgcolor="#FFFFFF">
    <td height="25" colspan="2">+学生添加</td>
  </tr>
  <form  action="?action=adduser" method="post" name="myform">
  <tr bgcolor="#FFFFFF">
    <td width="114" height="25">Candidate No</td>
    <td width="363" height="25">
	<input name="cno1" type="text" id="class" size="20"></td>
  </tr>
  <tr bgcolor="#FFFFFF">
    <td height="25">Candidate Name</td>
    <td height="25"><input name="name1" type="text" id="name" size="20"></td>
  </tr>
  <tr bgcolor="#FFFFFF">
    <td height="25">Class</td>
    <td height="25"><input name="class1" type="text" id="class" size="20"></td>
  </tr>
    <tr bgcolor="#FFFFFF">
    <td height="25">Username</td>
    <td height="25"><input name="username1" type="text" id="username" size="20"></td>
  </tr>
  <tr bgcolor="#FFFFFF">
    <td height="25">Password</td>
    <td height="25"><input name="password1" type="text" id="password" size="20"></td>
  </tr>

  <tr align="center" bgcolor="#FFFFFF">
    <td height="25" colspan="2"><input type="submit" name="Submit" value="提交"></td>
    </tr>
  </form>
</table>
<%
case "edit"
Set Rs=conn.Execute("Select * from user where id="&cint(Request.querystring("id")))
%>
<table width="500" border="0" align="center" cellpadding="5" cellspacing="1" bgcolor="#006d63" style="border-collapse: collapse">
  <tr bgcolor="#FFFFFF">
    <td height="25" colspan="2">+学生修改</td>
  </tr>
  <form  action="?action=edituser&id=<%=Rs(0)%>" method="post" name="myform">
    <tr bgcolor="#FFFFFF">
      <td width="114" height="25">Candidate No</td>
      <td width="363" height="25">
		<input name="cno" type="text" id="class" value="<%=Rs("c_no")%>" size="20"></td>
    </tr>
    <tr bgcolor="#FFFFFF">
      <td height="25">Candidate Name</td>
      <td height="25">
		<input name="name" type="text" id="name" value="<%=Rs("name")%>"> </td>
    </tr>
    <tr bgcolor="#FFFFFF">
      <td height="25">Class</td>
      <td height="25">
		<input name="class2" type="text" id="class" value="<%=Rs("class")%>" size="20"></td>
    </tr>
    <tr bgcolor="#FFFFFF">
      <td height="25">Username</td>
      <td height="25"><input name="username" type="text" id="username" value="<%=Rs("username")%>">
      </td>
    </tr>
<tr bgcolor="#FFFFFF">
      <td height="25">Password</td>
      <td height="25">
		<input name="password" id="password" value="<%=Rs("password")%>" size="20"><input name="xiugai" type="checkbox" id="xiugai" value="1"></td>
    </tr>


    <tr align="center" bgcolor="#FFFFFF">
      <td height="25" colspan="2"><input type="submit" name="Submit" value="提交"></td>
    </tr>
  </form>
</table>
<%
  Rs.Close
  Set Rs=Nothing
%>
<%end Select
  Conn.Close
  Set Conn=Nothing
%>
</body>
</html>