帮忙解释一段asp代码

来源:百度知道 编辑:UC知道 时间:2024/05/16 11:14:57
新手学习asp,现在有一段网上找的代码,但是按照自己的思路修改就出问题,个人感觉是因为没有看懂,希望各位高手帮忙解释一下,详细一些的好,谢谢了
</style>
<% sub studentlogin
dim student_number,student_password,mysql
student_number=trim(request.Form("student_number"))
student_password=trim(request.Form("student_password"))
if student_number="" then
session("stu_login")="学号不能为空!!"
response.Redirect "index.asp"
end if
if ((left(student_password,1)="&")) or (student_password="'") or (student_password="[") then
session("stu_login")="密码输入非法!!"
response.Redirect "index.asp"
end if
mysql="select * from 学生表 where 学生学号='"&student_number&"' and 密码='"&student_password&"'"
set objrs=getsqlrecordset(mysql,"asp练习.mdb")
if not objrs.eof then
session("student_number")=student_number
sess

<%
'声明过程studentlogin
sub studentlogin
'声明变量
dim student_number,student_password,mysql
'接收student_number数据并去掉空格(使用trim)
student_number=trim(request.Form("student_number"))
'接收student_password数据并去掉空格(使用trim)
student_password=trim(request.Form("student_password"))
'检查student_number数据是否为空(没有填写)
if student_number="" then
'初始化一个stu_login Session变量
session("stu_login")="学号不能为空!!"
'没有填写学号自动转到index.asp
response.Redirect "index.asp"
end if
'检查密码是否包含SQL注入攻击字符&/'/[
'检查&使用测试密码左边第一位字符方法
'检查'使用测试密码是否为'方法
'检查[使用测试密码是否为[方法
if ((left(student_password,1)="&")) or (student_password="'") or (student_password="[") then
'初始化一个stu_login Session变量
session("stu_login")="密码输入非法!!"
'密码非法时转到index.asp
respo