asp考试系统中遇到的一个问题

来源:百度知道 编辑:UC知道 时间:2024/05/16 12:28:19
今天下载了一个考试系统,遇到一个问题,就是用户名,密码不用验证就直接进入了试题页,这让我好奇怪,即使用户名和密码全空也能进入试题页.但明明是有验证过程的,为什么验证程序无效呢,看起来是没有问题的呀!.唉,不明白,请大家指点!程序验证程序如下:

<%
'程序名称:网上考试系统
'程序作者:韩波(bobby)
'OICQ:40274856 E-mail:bobbyhan@163.com
%>

<%
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='"& StudentI

改成这个试一下
<%
StudentID=Request("StudentID")
Name=Request("Name")
Subject=Request("Subject")
if StudentID="" then
response.Write "<script language='javascript'>alert('错误:请输入你的学号!');window.location.href='你要跳转的页面.asp';</script>"
response.End
end if
%>
<%

if Name="" then
response.Write "<script language='javascript'>alert('错误:请输入你的姓名!');window.location.href='你要跳转的页.asp';</script>"
response.End

end if
%>

如果StudentID在传递来的页面中或者QueryString中未定义的话,request("StudentID")<>""这个表达式是成立的,应该用
if isempty(request("StudentID")) or request("StudentID")="" then