二叔给吴邪看的照片:【asp】关于登陆验证的问题。

来源:百度文库 编辑:中科新闻网 时间:2024/05/05 08:24:25
<!--#include file="conn.asp"-->
<%
dim user,userpass,rs,sql
user=lcase(trim(request.Form(username)))
userpass=trim(request.Form(password))
if user="" then
response.write "<script>alert('用户名不能为空!');history.go(-1);</script>"
response.End()
end if

if userpass="" then
response.write "<script>alert('密码不能为空!');history.go(-1);</script>"
response.End()
end if

sql="select * from person where username='"&user&"'"
set rs=server.CreateObject("adodb.recordset")
rs.open sql,conn,1,1
if not(rs.eof and rs.bof) then
if rs("password")=userpass then
session("login")=true
session("UID")=rs("ID")
session("uname")=rs("name")
session("score")=rs("score")
session("username")=rs("username")
session("password")=rs("password")
rs.close
set rs=nothing
response.redirect "huiyuan.asp"
else
response.write "<script>alert('用户名和密码不能不配比!');history.go(-1);</script>"
response.End()
end if

end if
rs.close
set rs=nothing
%>
在运行的时候提示用户名为空。这是怎么会事》

你的登陆地方用户名处改成<input name="username" .....