| 网站首页 | 文章中心 | 下载中心 | 图片中心 | 中软BT下载站 | 趣味中心 | 雁过留声 | 索尔网络 | 
最新公告:

  没有公告

您现在的位置: 中软网 >> 文章中心 >> 网页设计 >> asp技术 >> 正文
专题栏目
更多内容
最新推荐 更多内容
相关文章
没有相关文章
更多内容
会员登陆的检测代码         ★★★
会员登陆的检测代码
【字体: 】【发表评论】【加入收藏】【告诉好友】【打印此文】【关闭窗口

************************* 获取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
%>

作者:admin 文章来源:本站原创 点击数: 更新时间:2006-8-22 11:21:26

  • 上一篇文章:

  • 下一篇文章:
  • 【字体: 】【发表评论】【加入收藏】【告诉好友】【打印此文】【关闭窗口
      网友评论:(只显示最新10条。评论内容只代表网友观点,与本站立场无关!)

    | 设为首页 | 加入收藏 | 联系站长 | 友情链接 | 版权申明
    中软网
        E-mail:solft@126.com ©中软网 版权所有
    信息产业部备案
    浙ICP备05074692号