<%
Dim arrInvalidDir
Dim pNum, pNum2, OpenTyClass, iOrderID, StructureType, HtmlDir
Dim ClassLink
arrInvalidDir = "HTML,JS,Special,List,Images,UploadFiles,UploadSoft,UploadSoftPic,UploadThumbs,UploadPhotos,UploadFlash,UploadVideo,UploadMusic"
%>
 |
用户管理 |
<%
Select Case Action
Case "Add"
Call AddUser
Case "SaveAdd"
Call SaveAdd
Case "Modify"
Call Modify
Case "SaveModify"
Call SaveModify
Case "ModifyPurview"
Call ModifyPurview
Case "SavePurview"
Call SavePurview
Case "Del"
Call Del
Case Else
Call main
End Select
Sub main()
Dim arrShowLine(20), i
For i = 0 To UBound(arrShowLine)
arrShowLine(i) = False
Next
Dim sqlu, rsu, iDepth, ClassDir, ClassItemDir
sqlu = "select * from t_user_info order by id"
Set rsu = Conn.Execute(sqlu)
%>
ID |
用户名 |
状态 |
操作选项 |
<%
If rsu.BOF And rsu.EOF Then
Response.Write "没有任何用户 | "
Else
Do While Not rsu.EOF
if rsu("id") = 1 then
else
%>
<%=rsu("id")%> |
<%
Response.Write "" & rsu("uid") & ""
'Response.Write " " & rsu("t_classid") & "," & rsu("PrevID") & "," & rsu("NextID") & "," & rsu("ParentID") & "," & rsu("RootID")
%> |
<%if rsu("status") = 0 then response.write "正常" else response.write "禁用"%> |
<%
if lcase(trim(AdminName)) <> "admin" and lcase(trim(rsu("uid"))) = "admin" then
response.write " | "
else
%>
修改信息
<%if trim(lcase(AdminName)) <> trim(lcase(rsu("uid"))) then%>
| 删除
<%end if%> |
<%end if%>
<%
end if
rsu.MoveNext
Loop
End If
rsu.Close
Set rsu = Nothing
%>
<%
End Sub
Sub AddUser()
%>
<%
Call WriteJS
End Sub
Sub WriteJS()
%>
<%
End Sub
Sub SaveAdd()
dim uid, pwd, cpwd, tel, mobiletel, fax, email, rc, i, arr_str, arr, e, statu
dim rs1,rs2,sql, max1, max2
uid = trim(request("UserName"))
pwd = MD5(trim(request("pwd")),32)
cpwd = MD5(trim(request("cpwd")),32)
tel = trim(request("tel"))
mobiletel = trim(request("mobiletel"))
fax = trim(request("fax"))
email = trim(request("email"))
rc = trim(request("rc"))
statu = trim(request("status"))
if statu = "on" then
statu = true
else
statu = false
end if
if uid = "" then
ErrMsg = "用户名不能为空!"
FoundErr = True
end if
if trim(request("pwd")) = "" then
ErrMsg = "密码不能为空!"
FoundErr = True
end if
if trim(request("cpwd")) = "" then
ErrMsg = "确认密码不能为空!"
FoundErr = True
end if
if pwd <> cpwd then
ErrMsg = "两次输入的密码不同!"
FoundErr = True
end if
isExist = conn.execute("select count(uid) from t_user_info where uid = '" & uid & "'")
if isExist(0) > 0 then
ErrMsg = "用户名已存在!"
FoundErr = True
end if
If FoundErr = True Then
Call WriteErrMsg(ErrMsg, ComeUrl)
exit sub
End If
for i = 1 to rc
e = trim(request("e"&i))
if e <> "" then
if arr_str = "" then
arr_str = "'"&e&"'"
else
arr_str = arr_str & "," & "'"&e&"'"
end if
end if
next
set rs1 = conn.execute("select id from t_user_info order by id desc limit 1")
if rs1.bof and rs1.eof then max1 = 1 else max1 = rs1(0)+1
conn.execute("insert into t_user_info (uid,pwd,username,tel,mobiletel,fax,email,id,status) values ('"&uid&"','"&pwd&"','"&uid&"','"&tel&"','"&mobiletel&"','"&fax&"','"&email&"',"&max1&","&statu&")")
'conn.execute("delete from t_role_equip where userid = " & uid)
arr = split(arr_str, ",")
for i = lbound(arr) to ubound(arr)
conn.execute("insert into t_role_equip (userid,uid) values ('"&uid&"','"&replace(arr(i),"'","")&"')")
next
rs1.close
set rs1 = nothing
response.Redirect("admin_user.asp")
End Sub
Sub Modify()
dim rs, rs2, rs3, uid, userType, isChecked
uid = trim(request("uid"))
if uid = "" then
ErrMsg = "参数错误!"
FoundErr = True
end if
set rs = conn.execute("select * from t_user_info where uid = '"&uid&"'")
if rs.bof and rs.eof then
ErrMsg = "不存在此用户!"
FoundErr = True
end if
%>
<%
Call WriteJS2
End Sub
Sub WriteJS2()
%>
<%
End Sub
Sub SaveModify()
dim uid, pwd, cpwd, tel, mobiletel, fax, email, rc, i, arr_str, arr, e, mpwd, statu
dim rs1,rs2,sql, max1, max2
uid = trim(request("UserName"))
pwd = MD5(trim(request("pwd")),32)
cpwd = MD5(trim(request("cpwd")),32)
mpwd = trim(request("mpwd"))
tel = trim(request("tel"))
mobiletel = trim(request("mobiletel"))
fax = trim(request("fax"))
email = trim(request("email"))
rc = trim(request("rc"))
statu = trim(request("status"))
if statu = "on" then
statu = true
else
statu = false
end if
if uid = "" then
ErrMsg = "用户名不能为空!"
FoundErr = True
end if
if mpwd = "yes" then
if trim(request("pwd")) = "" then
ErrMsg = "密码不能为空!"
FoundErr = True
end if
if trim(request("cpwd")) = "" then
ErrMsg = "确认密码不能为空!"
FoundErr = True
end if
if trim(request("pwd")) <> trim(request("cpwd")) then
ErrMsg = "两次输入的密码不同!"
FoundErr = True
end if
end if
If FoundErr = True Then
Call WriteErrMsg(ErrMsg, ComeUrl)
exit sub
End If
for i = 1 to rc
e = trim(request("e"&i))
if e <> "" then
if arr_str = "" then
arr_str = "'"&e&"'"
else
arr_str = arr_str & "," & "'"&e&"'"
end if
end if
next
if mpwd = "yes" then
conn.execute("update t_user_info set pwd='"&pwd&"',tel='"&tel&"',mobiletel='"&mobiletel&"',fax='"&fax&"',email='"&email&"',status="&statu&" where uid='"&uid&"'")
else
conn.execute("update t_user_info set tel='"&tel&"',mobiletel='"&mobiletel&"',fax='"&fax&"',email='"&email&"',status="&statu&" where uid='"&uid&"'")
end if
if uid <> "admin" then
conn.execute("delete from t_role_equip where userid = '" & uid & "'")
arr = split(arr_str, ",")
for i = lbound(arr) to ubound(arr)
conn.execute("insert into t_role_equip (userid,uid) values ('"&uid&"','"&replace(arr(i),"'","")&"')")
next
end if
response.Redirect("admin_user.asp")
End Sub
Sub Del()
dim uid, rs, userType
uid = trim(request("uid"))
'set rs = conn.execute("select group_id from t_role_user where userid = '" & uid & "'")
'if rs.bof and rs.eof then userType = 18 else userType = rs(0)
conn.execute("delete from t_user_info where uid = '" & uid & "'")
conn.execute("delete from t_role_equip where userid = '"&uid&"'")
response.Redirect "admin_user.asp"
End Sub
%>
|