首页
印 像 新 闻 系 统
网站首页 公告信息 编程实例 PHP函数 摄影无界 全景展示 我的作品 意见专栏
 

ASP登陆代码和会员级别类!

【2006年01月09日 16:04:01】 【阅读:次】 【字体:大 中 小 默认】 【背景:#换背景 #换背景 #换背景 #换背景 #换背景 #换背景 #换背景 默认】

<%
dim name,rs,ps
name=request("user")
ps=md5(request("pass"))
set rs=server.CreateObject("adodb.recordset")
if name<>"" or ps<>"" then
   rs.Open "select * from [user] where username="&name&"",conn,2
   if not rs.EOF then
      if not rs("userpassword")=ps then
   response.write "<script language=JavaScript>" & chr(13) & "alert(密码错误);" & "history.back()" & ""
      response.End()
   %>
      <%else
      if rs("userClass")<>"" then

   response.cookies("gbook")("username")=rs("username")
      response.cookies("gbook")("password")=ps

if theUser.admin then
  response.write "<script language=JavaScript>" & chr(13) & "alert(登陆成功!);" & "window.location.href(loginnnn.asp);" & ""
  response.redirect "Admin_Index.asp"
elseif theUser.master then
  response.write "<script language=JavaScript>" & chr(13) & "alert(登陆成功!);" & "window.location.href(Admin_Index.asp);" & ""
  response.redirect "user_login_lr.asp"
end if 
   else

      response.cookies("gbook")("username")=rs("username")
      response.cookies("gbook")("password")=ps

            Response.Redirect "user_login_lr.asp"
   end if
      end if
   else
      response.write "<script language=JavaScript>" & chr(13) & "alert(你不是本站用户,请先注册!);" & "window.location.href(error.asp);" & ""
   end if
else
response.write "<script language=JavaScript>" & chr(13) & "alert(您什么也没有填);" & "history.back()" & ""
    response.End()
 end if
%>

类:

set theUser=new users


class users
 dim name,pass,reged,master,male,,admin
 
 private sub class_initialize()
  dim rs,sql
  name=request.cookies("gbook")("username")
  if name<>"" then
   name=name
  end if
  pass=request.cookies("gbook")("password")
  if name="" or pass="" then
   reged=false
   master=false
   admin=false
   male=true
  else
   sql="select top 1 username,userpassword,userclass from [user] where username="&name&" and userPassword="&pass&" "
   set rs=conn.execute(sql)
   if rs.eof and rs.bof then
    reged=false
    master=false
    admin=false
    male=true
   else
    reged=true
    if rs("sex")="1" then
     male=true
    else
     male=false
    end if
    if rs("userclass")=20 or rs("userclass")=19 then
     master=true
    else
     master=false
    end if
    if rs("userclass")=20 then
     admin=true
    else
     admin=false
    end if
   end if
  end if
 end sub
 end class


(『印像空间』 【本文来源:『学习笔记』】 【作者:未知】 【录入:留印】)
限200字,剩余 字
关 键 字:
    
搜索条件: