为什么不用输入准考证号和姓名就可以登录?
pbkok 2012-03-14 05:32:09 我下载了一个在线考试系统源代码 为什么不用输入准考证号和姓名就可以登录?
这个是login.asp源码
<html>
<head>
<title>用户登录</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<LINK href="style.css" rel=stylesheet>
<style type="text/css">
<!--
a { color: #000000; text-decoration: none}
.bt { font-size: 9pt; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; height: 16px; width: 80px; background-color: #eeeeee; cursor: hand}
-->
</style>
</head>
<body background="images/bj.gif" link="#000000" vlink="#FF0000" alink="#000000">
<p align="center">
<img border="0" src="images/logo.gif" width="493" height="107">
<table width="350" border="1" cellspacing="0" cellpadding="0" align="center" bordercolorlight="#CCCCCC" bordercolordark="#FFFFFF">
<tr bgcolor="#33CCFF">
<td colspan="2" width="346">
<div align="center">考生登录</div>
</td>
</tr>
<tr bgcolor="#F0F0F0">
<td colspan="2" width="346">
<blockquote>
<form method="GET" action="chklogin.asp" >
<p align="center">准考证号<input type="text" name="StudentID" size="16" maxlength="10"></p>
<p align="center">姓 名<input type="text" name="Name" size="16" maxlength="10"></p>
<p align="center">
考试科目
<select name="Subject">
<!-- #include file="connect.asp" -->
<%rs.Open "Select * From 试卷信息 Order By 创建日期 DESC", conn, 1,1
while not rs.eof%>
<option value="<%=rs("试卷名称")%>"><%=rs("试卷名称")%></option>
<%
rs.movenext
wend
rs.close%>
</select></p>
<div align="center">
<input type="submit" name="send" value="登录" >
<input type="reset" value="重写" >
</div>
</form>
</blockquote>
</td>
</tr>
<tr><td bgcolor="#F0F0F0" width="173">
<p align="center"><a href="readme.htm" class="bt"><font color="#000000">使用说明</font></a></p>
</td><td bgcolor="#F0F0F0" width="171">
<p align="center"><a href="adminlogin.htm" class="bt"><font color="#000000">管理登陆</font></a></td></tr>
</table>
<p align="center">作者:韩波
指导教师:徐新农</p>
<p align="center">单位:物理工程学院电子信息工程专业</p>
<p align="center">2003.5.1</p>
</body>
</html>
chlkogin.asp源码
<%
StudentID=Request("StudentID")
Name=Request("Name")
Subject=Request("Subject")
if StudentID="" then %>
<script language=vbscript>
MsgBox "错误:请输入你的学号!"
location.href = "javascript:history.back()"
</script>
<%
end if
if Name="" then%><script language=vbscript>
MsgBox "错误:请输入你的姓名!"
location.href = "javascript:history.back()"
</script> <%
end if%>
<!-- #include file="connect.asp" -->
<%
rs.Open "Select * From 学生信息 where StudentID='"& StudentID &"'", conn,1,1%>
<%if rs.bof then %>
<script language=vbscript>
MsgBox "错误:此学号不存在!"
location.href = "javascript:history.back()"
</script>
<%
elseif Name<>rs("Name") then%>
<script language=vbscript>
MsgBox "错误:你的学号和你的姓名不一致,请查正!"
location.href = "javascript:history.back()"
</script>
<%end if
rs.close
rs.open "select * from 成绩表 where StudentID='"&StudentID&"' and 试卷名称='"&Subject&"'",conn,1,1
if not rs.eof then%>
<script language=vbscript>
MsgBox "错误:你已经参加过这一门的考试了!"
location.href = "javascript:history.back()"
</script>
<%else
session("logstatus")=1 '记录登陆状态
response.redirect "testpaper.asp?"&Request.QueryString
end if
conn.close
set rs=nothing%>