% option explicit %> <% if session("purview")<>"99999" then response.write "错误!!您没有权限或者连接超时,请重新登陆." %> 登陆 <% response.end end if dim isedit '是否在编辑状态 dim color '表格颜色 dim userid dim sql,rs,rsc userid=request("userid") color=1 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 users set name='" & cstr(trim(request("username"))) & "',pwd='" & 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 users where name='" & 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 users(name,pwd,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 users where userid=" + cstr(userid) conn.execute sql if err.number <> 0 then response.write "数据库操作错误:" + err.description err.clear else %> <% end if end if %>
|
-----用 户 名-----
|
-----权 限-----
|
操作
|
| "> | ">
<% if rs("purview")="99999" then
response.write "管理员"
else if rs("purview")="99998" 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
end if %>
|
">
<% if trim(rs("name"))=trim(session("name")) then
response.write "----"
else
response.write "删除"
end if %>
|
<% if isedit then
set rs=server.createobject("adodb.recordset")
set rsc=server.createobject("adodb.recordset")
rs.open "select * from users where userid=" & cstr(request("userid")),conn,1,1
rsc.open "select * from type where typeid=" & cstr(rs("purview")),conn,1,1
response.write "编 辑 用 户
"
else
response.write "添 加 新 用 户
"
end if %>