<html>
<head>
<title>department</title>
<%@ page contentType="text/html;charset=gb2312" %>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<script language="JavaScript">
<!--
function MM_reloadPage(init) {  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);
// -->
</script>
</head>

<body bgcolor="#FFFFFF" text="#000000">
<div id="Layer1" style="position:absolute; width:780px; height:51px; z-index:1; left: 0px; top: 0px; background-color: #66CC66; layer-background-color: #66CC66; border: 1px none #000000"> 
  <div id="Layer4" style="position:absolute; width:50px; height:20px; z-index:4; left: 708px; top: 31px">
    <div align="center"><b><a href="teacher.jsp">返回</a></b></div>
  </div>
  <p>&nbsp; </p>
</div>

<div id="Layer2" style="position:absolute; width:325px; height:30px; z-index:2; left: 187px; top: 50px"> 
  <div align="center"><font color="#66CC66"><b><font color="#669900" size="5">查询结果</font></b></font></div>
</div>
<div id="Layer3" style="position:absolute; width:610px; height:695px; z-index:3; left: 68px; top: 80px"> 

<%@ page language="java" import="java.sql.*" %>
<jsp:useBean id="workM" scope="page" class="regist.conn"/>
<%!
  public String getStr(String str)
 {
   try
    {
     String temp_p=str;
     byte[] temp_t=temp_p.getBytes("ISO8859-1");
     String temp=new String(temp_t);
     return temp;
    }
  catch(Exception e)
  {

  }
   return "null";
 }
 %> 
<%!
 String logname,selectzc,selectxy;
 String errorMessage="";
%>
<%
 logname=request.getParameter("logname");
  selectzc=request.getParameter("selectzc");
 selectxy=request.getParameter("selectxy");
 logname=getStr(logname);
 selectzc=getStr(selectzc);
 selectxy=getStr(selectxy);
 boolean loginOK=false;
 String sql;
sql="select * from databases where name='"+logname+"'and zhicheng='"+selectzc+"'and department='"+selectxy+"'";
if((logname==null||logname.equals(""))&&(selectzc==null||selectzc.equals(""))&&                  (selectxy==null||selectxy.equals("")))
{sql="select * from databases";}
else{ if(logname!=""&&(selectzc==null||selectzc.equals(""))&&
           (selectxy==null||selectxy.equals("")))
     {sql="select * from databases where name='"+logname+"'";}
     else {if((logname==null||logname.equals(""))&&selectzc!=null&&
                 (selectxy==null||selectxy.equals("")))
              {sql="select * from databases where zhicheng='"+selectzc+"'";}
          else { if((logname==null||logname.equals(""))&&                 (selectzc==null||selectzc.equals(""))&&selectxy!=null)
                 {sql="select * from databases where  department='"+selectxy+"'";}
                else {if(logname!=null&&selectzc!=null&&(selectxy==null||selectxy.equals("")))
                      {sql="select * from databases where name='"+logname+"'and                                           zhicheng='"+selectzc+"'";}
                      else {if(logname!=null&&(selectzc==null||selectzc.equals(""))
                            &&selectxy!=null)
                          {sql="select * from databases where name='"+logname+"'and                                                department='"+selectxy+"'";}
                          else {if((logname==null||logname.equals(""))
                                            &&selectzc!=null&&selectxy!=null)
                                {sql="select * from databases where zhicheng='"+selectzc+"'and                                     department='"+selectxy+"'";}
                               }
                          }
                   }
             }
        }
}
ResultSet RS=workM.executeQuery(sql);  
while(RS.next()){
 loginOK=true;
 String aa=RS.getString("teacher-id");
 String bb=RS.getString("name");
 String cc=RS.getString("sex");
 String dd=RS.getString("department");
 String ee=RS.getString("address");
 String ff=RS.getString("birthday");
 String gg=RS.getString("zhicheng");
 String hh=RS.getString("e-mail");
 String ll=RS.getString("course1");
 String mm=RS.getString("course2");
%>
 <table width="100%" border="1" height="34" bordercolor="#66CC00">
    <tr> 
   <td width="15%" height="38"><div align="center"><%=aa%></div></td>
   <td width="16%" height="38"><div align="center"><%=bb%></div></td>
   <td width="7%" height="38"><div align="center"><%=cc%></div></td>
      <td width="36%" height="38" bordercolor="#00CC00"><div align="center"><%=dd%></div></td>
      <td width="26%" height="38"><div align="center"><%=ee%></div></td> 
    </tr>
   </table>  
 <table width="100%" border="1" height="42" bordercolor="#66CC00">
   <tr>
      <td width="19%" height="35"><div align="center"><%=ff%></div></td>
      <td width="12%" height="35"><div align="center"><%=gg%></div></td>
      <td width="28%" height="35"><div align="center"><%=hh%></div></td>
      <td width="20%" height="35"><div align="center"><%=ll%></div></td>
      <td width="21%" height="35"><div align="center"><%=mm%></div></td>
    </tr>
  </table>
 <table width="100" border="0" heigth="40">
  <tr>
     <td height="32">&nbsp;</td>
   </tr>
 </table>
<%
  }
 if(!loginOK){
%>
  <div id="Layer5" style="position:absolute; width:603px; height:115px; z-index:1; top: 6px; left: 3px"> 
    <div align="center">
      <p><font face="华文彩云" size="6"><b><font color="#FF9900">对不起，没有您所需要的信息，</font></b></font></p>
      <p><font face="华文彩云" size="6" color="#FF9900"><b>请确认后再查！</b></font></p>
    </div>
  </div>
<%
}
RS.close();
%>
</div>
</body>
</html>
