log.jsp
上传用户:mkymky1985
上传日期:2014-06-23
资源大小:754k
文件大小:2k
- <html>
- <head>
- <meta http-equiv="Content-Type" content="text/html; charset=gb2312">
- <title>无标题文档</title>
- <style type="text/css">
- <!--
- @import url("_notes/bbb.css");
- a:link {
- color: #000000;
- }
- a:visited {
- color: #000000;
- }
- -->
- </style>
- </head>
- <body >
- <%@ page contentType="text/html; charset=gb2312"%>
- <%@ page language="java" import="java.sql.*"%>
- <jsp:useBean id="subject" scope="page" class="wsxk.ConDB"/>
- <%
- String select = new String (request.getParameter("select"));
- String wnum=new String(request.getParameter("wnum").trim().getBytes("8859_1"));
- String word=new String(request.getParameter("word").trim().getBytes("8859_1"));
- String state = new String();
- int typeid =Integer.parseInt(select);
- System.out.println(wnum);
- String sql = new String();
- switch(typeid)
- {
- case 0: {sql="select * from student where stuid='"+wnum+"' and stupsw='"+word+"'";
- break;}
- case 1: {sql="select * from teacher where teaid='"+wnum+"' and teapsw='"+word+"'";
- break;}
- case 2: {sql="select * from admin where adminname='"+wnum+"' and adminpsw='"+word+"'";
- break;}
- }
- //String sql="select tpri from administrators where wnum='"+wnum+"' and wpswd='"+word+"'";
- ResultSet rs=subject.executeQuery(sql);
- if(rs.next()){
- System.out.println(rs.getString(1));
- System.out.println(rs.getString(2));
- String tpri=rs.getString("tpri");
- session.setAttribute("wnum",wnum);
- session.setAttribute("select",select);
- switch(typeid)
- {
- case 0: {response.sendRedirect("index1.jsp");
- break;}
- case 1: {response.sendRedirect("index2.jsp");
- break;}
- case 2: {response.sendRedirect("index3.jsp");
- break;}
- }
- rs.close();
- }
- else
- {
- rs.close();
- %>
- <table width="375" border="0" align="center">
- <tr>
- <td height="168"><img src="images/404.gif" width="484" height="361"></td>
- </tr>
- </table>
- <table width="257" height="68" border="0" align="center">
- <tr>
- <td><div align="center">
- <a href="index1.htm"><strong>返回首页 </strong></a> </div></td>
- </tr>
- </table>
- <%}%>
- </body>
- </html>