當前位置:編程學習大全網 - 網站源碼 - 我用asp做系統時,想要登錄時通過判斷權限來決定是登錄到管理員頁面還是學生界面

我用asp做系統時,想要登錄時通過判斷權限來決定是登錄到管理員頁面還是學生界面

比如說,表是user,用戶名字段名是user_name,密碼字段名是user_code,權限字段名是user_right,可以自行定義壹個規則,比如說,1是管理員,0是學生。整個驗證過程 :

<%

user_name=request.form("user_name")

user_code=request.form("user_code")

''''中間的安全過濾自己寫

sql="select * from user where user_name='"&user_name&"' and user_code='"&user_code&"'"

set rs=conn.execute(sql)

if(rs.eof and rs.bof) then

'''這裏寫用戶不存在的代碼段

else

if(rs("user_right")=1) then

''如果user_right字段是1,則跳轉到管理員界面

response.redirect("管理員頁面的名字")

else

''如果不是1,就跳轉到學生界面

response.redirect("學生界面的名字")

end if

end if

rs.close

set rs=nothing

%>

不知道我答沒答對,或者理沒理解對妳的意思。

  • 上一篇:visual studio2012統計行數的時候註釋的算不算
  • 下一篇:什麽是紅白機?和GBA有什麽區別?
  • copyright 2024編程學習大全網