文章搜索: 分类 关键字

   您的位置:首页网络编程Asp专区 → 会员登陆的检测代码
会员登陆的检测代码
日期:2006-2-3 1:38:35 人气:     [ ]
<%
'////////////////////////// 获取From的值

if Request.ServerVariables("Request_Method")="POST" then
 set Rs=server.createobject("adodb.recordset")
 Username=trim(request.form("name"))
 psw=trim(request.form("password"))

 '/////////////////////////// 判断不能为空

 if Username="" or psw="" then
  Response.write "<script>alert('用户名和登陆密码不能为空');</script>"
  Response.write "<script>history.go(-1);</script>"
  Response.end
 end if

 '/////////////////////////// 用Session来限制错误输入次数(3次)

 if Session("err")>=3 then
  errorr=1
  errmsg="你已经重试这么多次了,累了吧,请歇会再来,或者联系管理员!"
 else
 sql="select * from WebMaster where UserName='"&UserName&"'"
 Rs.open sql,cn,3,1
 if Rs.eof and Rs.bof then
  errorr=1
  Session("err")=Session("err")+1
  errmsg="用户名不存在,请返回重新填写确认!"
  Rs.close
 elseif psw<>Rs("PassWord") then
  errorr=1
  Session("err")=Session("err")+1
  errmsg="用户名和密码不符,请确认后再输一次!"
  Rs.close
 end if
 end if

 if errorr=1 then
  Response.write "<script>alert('"&errmsg&"');</script>"
  Response.write "<script>history.go(-1);</script>"
  Rs.close
  Set Rs=Nothing
  Cn.Close
  Response.end
 end if

 '/////////////////////////// 检验成功赋值给Session,最后重定向页面。

 Response.cookies("UserName")=Rs("UserName")
 Response.cookies("UserKey")=Rs("UserKey")
 Rs.close
 Set Rs=Nothing
 Cn.Close
 Session("err")=0
 Response.write "<script>location.href='MasterMain.asp';</script>"
end if
%>
出处:CnCode转载收集 作者:不详
<---->
 
| 关于本站 | 帮助(?) | 广告服务 | 版权声明 | 业务合作 | 发展历程 | 加盟我们 | 联系我们 | 中国源码中心 ≮为您提供建站帮助≯

  中国源码中心 版权所有 Copyright© 2002-2006 Www.CnCode.Com, All Rights Reserved. Powered By 中国源码中心