asp登录校验及登录检测

<%

dim name,pwd

name=trim(request("name"))

pwd=trim(request("pwd"))

if name=”” or pwd=”” then

response.Write "<script>alert('账户密码不能为空!');location='manage/main.asp'</script>"

else

set rs=server.createobject("adodb.recordset")

sql="select * from admin where name='"&name&"'"

rs.open sql,conn,1,1

 

if not rs.eof then

 if pwd=rs("pwd") then

  session("mm_username")=""

  session("mm_username")=rs("name") 

session("qx")=rs("qx") 

  response.Write "<script>alert('登陆成功');location='manage/main.asp'</script>"

 else

  Response.Write "<script language='javascript'>window.confirm('帐号和密码不正确,请返回重填!');parent.window.history.go(-1);</script>"

 end if

else

  Response.Write "<script language='javascript'>window.confirm('用户名不正确,请返回重填!');parent.window.history.go(-1);</script>"

end if

end if

%>

posted @ 2018-06-08 11:28  黑旗君  阅读(418)  评论(0编辑  收藏  举报