如何对这些用户进行验证

  如何对这些用户进行验证

       <%     dim     txtName,txtPsw     txtName=trim(request.Form("textfield"))     '表单域中输入的帐号     txtPsw=trim(request.Form("textfield2"))     '表单域中输入的密码         if   txtName=""   or   txtPsw=""   then     response.Write   "用户名或密码不能为空!"       response.End()     end   if         dim   objConn,objRs,strSQL                 Set   objConn   =   Server.CreateObject("ADODB.Connection")                                                                 objConn.ConnectionString   =   "Provider=Microsoft.Jet.OLEDB.4.0;Data   Source="   &   Server.MapPath("你的数据库名.mdb")                                           objConn.Open     strSQL   =   "select   *   Login   where   Account='"   &   txtName   &   "'"       'Account   是数据库中的帐号字段             Set   objRs   =   Server.CreateObject("ADODB.Recordset")               objRs.Open   strSQL,objConn,   1,1     if   objRs.eof   then     objRs.close     set   objRs   =   nothing     objConn.close     set   objConn   =   nothing     response.Write   "此用户不存在,请确定用户名!"       response.End()     end   if     if   objRs("Password")<>txtPsw   then           'Password   是数据库中的密码字段     objRs.close     set   objRs   =   nothing     objConn.close     set   objConn   =   nothing     response.Write   "密码不正确,请确认密码!"       response.End()     end   if     dim   rank     rank   =   objRs("rank")             'rank   是数据库中的权限字段   ,如:1是管理员,2是会员,3是普通用户           objRs.close     set   objRs   =   nothing     objConn.close     set   objConn   =   nothing     if   rank=1   then     response.Redirect("webs/index1.asp")     elseif   rank=2   then     response.Redirect("webs/index2.asp")     elseif   rank=3   then     response.Redirect("webs/index3.asp")     end   if         %>

发布了5 篇原创文章 · 获赞 5 · 访问量 5万+
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章