主题:  在ASP里连接本栏目的页面显示不出来

曹飞

职务:普通成员
等级:1
金币:0.0
发贴:11
#12002/2/1 16:58:37

<%
IF (Session("REGISTER")="REGISTED" ) THEN    
IF (session("purview")="9999" ) THEN
%>

<%
userid=request("userid")
isedit=false
if request("action")="edit" then
isedit=true
end if

%>
<%
if request("action")="modify" then '*****************修改用户*****************
if trim(request("userpassword"))="" then
     response.write "错误!密码不能为空! 返回"
response.end
end if
    sql="update admin set username='" & cstr(trim(request("username"))) & "',password='" & cstr(trim(request("userpassword"))) & "',purview=" & cstr(request("purview")) & "where userid=" & cstr(request("userid"))
    conn.execute sql
    if err.number <> 0 then
     response.write "数据库操作出错:" + err.description
    else %>
    
<%end if
end if
%>
<%
if request("action")="add" then '*******************添加新用户****************
if trim(request("username"))="" or trim(request("userpassword"))="" then
     response.write "错误!用户名或密码不能为空! 返回"
response.end
end if
    set rs=server.createobject("adodb.recordset") '检查用户是否重名
rs.open "select * from admin where username='" & cstr(trim(request("username"))) & "'",conn,1,1
if err.number <> 0 then
     response.write "数据库出错"
else if not rs.bof and not rs.eof then
     response.write "错误!该用户名已存在! 返回"
response.end
end if
end if
    rs.close
    set rs=nothing
    sql="insert into admin(username,password,purview) values('" & cstr(trim(request("username"))) & "','" & cstr(trim(request("userpassword"))) & "'," & cstr(request("purview")) & ")"
    conn.execute sql

if err.number <> 0 then
     response.write "数据库操作出错:" + err.description
    else %>
    
<%end if

end if %>
<%
if request("action")="del" then '*******************删除用户******************
    sql="delete from admin where userid=" + cstr(userid)
    conn.execute sql
    if err.number <> 0 then
        response.write "数据库操作错误:" + err.description
        err.clear
    else %>

<% end if
end if
%>



用户管理
















管理导航



发布新闻 新闻类别管理 新闻摸板管理 用户管理 JS代码 安全退出








<%
set rs=server.createobject("adodb.recordset")
rs.open "select * from admin",conn,1,1
if err.number <> 0 then
     response.write "数据库出错"
else
     if rs.bof and rs.eof then
         rs.close
         response.write "目前没有用户"
     else
             do while not rs.eof %>





<% rs.movenext                    
     loop
         end if
end if
    rs.close
    set rs=nothing %>

-----用 户 名-----


-----权 限-----


操作





<% if rs("purview")="9999" then
             response.write "系统管理员"
         else
             set rsc=server.createobject("adodb.recordset")
             rsc.open "select typename from type where typeid=" & rs("purview"),conn,1,1
             if err.number <> 0 then
     response.write "数据库出错"
else
     if rsc.bof and rsc.eof then
         response.write "无效用户"
     else
                 response.write rsc("typename")&"管理员"
                    end if
              end if
             rsc.close
            set rsc=nothing
end if
%>



        <%response.write "删除"%>
    





<% if isedit then %>
编 辑 用 户
    
<% set rs=server.createobject("adodb.recordset")
         set rsc=server.createobject("adodb.recordset")
         rs.open "select * from admin where userid=" & cstr(request("userid")),conn,1,1
         rsc.open "select * from type where typeid=" & cstr(rs("purview")),conn,1,1
%>



用户账号:
    %>>
    

用户密码:

    

用户权限:








<% else %>
添 加 新 用 户
    



用户账号:



用户密码:



用户权限:








<% end if %>



<%
else
response.redirect "usermanage.asp"
    response.end
END IF
else
    response.redirect "login.asp"
    response.end
end if
%>