<%@page contentType="text/html;charset=GBK"%>
<%@page import="java.sql.*" errorPage="/public/error.jsp"%>
<%@ include file="/public/checkvalidadmin.jsp"%>
<%@ include file="/public/checkvalidadmin8.jsp"%>
<jsp:useBean id="conn" scope="page" class="test.ConnOracle"/>

<%!
String classid   = "";
String classname = "";
String totaltime    = "";
String totalques    = "";
String totalpaper   = "";

String oper = "";
String sql = "";

int result = 0;
%>

<html>

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

<Body class="ss">
<center>

<%
request.setCharacterEncoding("GBK");

classid   = request.getParameter("classid");
classname = request.getParameter("classname");
totaltime = request.getParameter("totaltime");
totalques = request.getParameter("totalques");
totalpaper= request.getParameter("totalpaper");

// 避免用户直接在浏览器地址栏输入页面地址所产生的Exception
if(classid==null || classid.equals("")) {
    out.println("<center>");
	out.println("请进行合法操作！");
	out.println("</center>");
	return;
}
try{
	sql = "insert into test_classinfo values('" + classid + "'" ;
	sql+= ",'" + classname + "'";
	sql+= "," + totaltime;
	sql+= "," + totalques;
	sql+= ",0)";             // totalpaper是由系统控制的，不允许直接输入

	result = conn.executeUpdate( sql );
	if(result != 1) {
		out.println("<center>");
		out.println("添加班级信息操作失败！<br><br>");
		out.println("单击这里<a href=javascript:history.back()>返回</a><br>");
		out.println("</center>");
		return;
	}
}catch(Exception ee) {
	out.println("<center>");
	out.println("班级信息添加失败！<br><br>");
	out.println("请将下列信息告知管理员<br><br>");
	out.println(ee.toString() + "<br><br>");
	out.println("单击这里<a href=javascript:history.back()>返回</a><br>");
	out.println("</center>");
	return;
}
%>
<jsp:forward page="classmanager.jsp"/>
</center>
</Body>

</html>