<%@ Language=VBScript %>
<% option explicit %>
<!--#include file="conn.asp"-->
<% if Request.ServerVariables("http_method")="POST" then    
	if Request.Form("submit")="登    录" then
		'学生登录的处理
	       dim rs,sql	
		set rs = server.createobject("adodb.recordset")
	            sql="select * from student where studentname='" & Request.Form("studentname") & "' and studentpassword='" & Request.Form("studentpassword") & "'"
                    rs.open sql,conn,1,1
               if err.number<>0 then 
		response.write "数据库操作失败："&err.description
               else if rs.bof and rs.eof then
			
		        response.write "<center>对不起，请输入正确的用户名和密码。</center>"
			    rs.close		    
	       else		
	            rs.close
				session("studentname")=request.form("studentname")
				session("studentpassword")=request.form("studentpassword")
				set rs=nothing
				call endConnection()
				Response.Redirect "selectsubject.asp"
			
		end if
       end if	
		'管理员进行管理
	elseif Request.Form("submit")="管    理" then
		Response.Redirect "admin/login.asp"		
	end if
end if
%>
<HTML>
<HEAD>
<META NAME="在线考试系统" >
</HEAD>
<BODY background=images/backimage.gif>
<table width="75%" border="0" align="center" height="464">
  <tr>
    <td height="420"> 
      <FORM action="default.asp" method=post id=form name=form>
        <P align=center><FONT color=green face=华文行楷 size=6>欢迎使用网上考试系统 V 1.0</FONT></P>
    <P align=center>姓名 
      <INPUT id=1 name=studentname>
    </P>
    <P align=center>密码 
          <INPUT id=2 name=studentpassword type="password">
    </P>
    <P align=center> 
      <INPUT id=submit1 name=submit type=submit value="登    录">
      <INPUT id=submit3 name=submit type=submit value="管    理">
    </P>
  </FORM>
  </td>
  </tr>
</table>
<!--#include file="foot.htm"-->
</BODY>
</HTML>
