CSDN博客

img yanweidong1030

自己写的权限管理.

发表于2004/7/8 10:18:00  948人阅读

分类: ASP

-----------------------conn.asp--------------------

<!--#include file="inc/md5.asp"-->
<!--#include file="inc/base64.asp"-->
<%

Response.Buffer = True
Response.ExpiresAbsolute = Now() - 1
Response.Expires = 0
Response.CacheControl = "no-cache"

if session("login_admin")="" or session("login_admin")=null then
response.write("<script>alert('请登录后再用!');window.location=('admin_index_1.asp')</script>")
response.end
end if

temp=trim(Mid(Request.ServerVariables("script_name"),6))

Session.Timeout=10

 dim conn
 dim connstr
 on error resume next

 connstr="PROVIDER=SQLOLEDB;DATA SOURCE=localhost;UID=jicai;PWD=welcome;DATABASE=jincai2"

 set conn=server.createobject("ADODB.CONNECTION")
        conn.open connstr
        if err.number<>0 then
  err.clear
  set conn=nothing
  response.write "数据库连接出错!"
  Response.End
        end if
      A=Instr("admin_listnews.asp|homemess.asp|showreturn.asp|listusers.asp|PriceManage.asp|usermoney.asp|banks.asp|getmoney_log.asp|saled_log.asp|xstj.asp|xshz.asp|buy_log.asp|get_nation.asp|any_rec.asp|any_rec3.asp|get_nation.asp|listols.asp|listgames.asp|admin_cardsadd1.asp|admin_cardslist.asp|admin_addcardlog.asp|listAdmins.asp|AdminLevel.asp|admin_login_log.asp|System_Clear.asp|",temp)
     if A<>0 then
       A=Instr(Session("Level"),temp)
       if A=0 then
         Response.write("对不起,你没有权限访问此功能!")
         Response.end
       end if
     end if 
 sub endConnection()
  conn.close
  set conn=nothing
 end sub
%>

_____________________________________________________

---------------------------Login.asp----------------------------------

session("Level")=rsadmin("Level")

_____________________________________________________

--------------------------Save_level-----------------------------------

<%
 for i=1 to 24
  if Len(trim(Request.form("checkbox"&i)))<>0  then
     Response.write("&nbsp;"&Request.form("checkbox"&i)&"........√ OK!<br>")
    tempstr=tempstr&Request.form("checkbox"&i)&"|"
  end if
 Next
Conn.Execute("Update admin set Level='"&tempstr&"' where id="&Request.form("Adminuser"))
%>

-----------------------------------------------------------------------

0 0

相关博文

我的热门文章

img
取 消
img