123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609 |
- <!--#include file="common.asp"-->
- <!--#include file="Inc/MD5.asp"-->
- <!--#include file="Inc/Function.asp"-->
- <%
- Dim uid, rsRole, isAdmin
- uid = trim(request("uid"))
- if trim(Lcase(AdminName)) = "admin" then
- isAdmin = true
- else
- isAdmin = false
- end if
- %>
- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
- <html xmlns="http://www.w3.org/1999/xhtml">
- <head>
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
- <title><%=systemPageTitle%></title>
- <link href="bs2010.css" rel="stylesheet" type="text/css" />
- <script type="text/javascript" src="js/share.js"></script>
- <script type="text/javascript" src="js/prototype.js"></script>
- <script language="javascript">
- function GetData()
- {
- url="alarm.asp";//调用页面
- var xmlhttp=null;
- if(window.XMLHttpRequest)
- {
- xmlhttp=new XMLHttpRequest();
- }
- if(!xmlhttp&&window.ActiveXObject)
- {
- try
- {
- xmlhttp=new ActiveXObject("Msxml2.XMLHTTP.5.0")
- }
- catch(e)
- {
- try
- {
- xmlhttp=new ActiveXObject("Msxml2.XMLHTTP.4.0")
- }
- catch(e){
- try
- {
- new ActiveXObject("Msxml2.XMLHTTP")
- }
- catch(e)
- {
- try{
- new ActiveXObject("Microsoft.XMLHTTP")
- }catch(e)
- {
- }
- }
- }
- }
- }
- if(!xmlhttp){alert("XMLHTTP不可用,请升级安装。");location="support/msxml.msi"}
-
- xmlhttp.open("GET",url,false);
- xmlhttp.send();
- var str = xmlhttp.responseText;
- document.getElementById("loadcontent").innerHTML=str;
-
- setTimeout("GetData()",<%=refreshRate%>);
- }
- </script>
- </head>
- <body onLoad="javascript:GetData();">
- <table width="100%" border="0" cellspacing="0" cellpadding="0">
-
- <tr>
- <td class="mainbg"><table width="760" border="0" cellspacing="0" cellpadding="0">
- <tr>
- <td valign="top">
- <div id="loadcontent">
- <p></p>
- 数据载入中……</div>
- <p>
- <%
- 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"
- %>
- <table width="100%" border="0" cellspacing="0" cellpadding="0">
- <tr>
- <td width="20" height="40"><span class="deviceName"><img src="images/arr1.gif" width="14" height="18" /></span></td>
- <td><span class="deviceName">用户管理</span></td>
- </tr>
- </table>
- <table width='100%' border='0' align='center' cellpadding='2' cellspacing='1' class='border'>
- <tr class='tdbg'>
- <td width='70' height='30'><strong>管理导航:</strong></td>
- <td height='30'><a href='Admin_user.asp'><%=ChannelShortName%>用户管理首页</a> | <a href="admin_user.asp?Action=Add">添加用户</a></td>
- </tr></table>
- <%
- 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)
- %>
- <br>
- <table width='100%' border='0' align='center' cellpadding='0' cellspacing='1' bgcolor="#CCCCCC" class='border'>
- <tr class='title' height='22'>
- <td width='30' align='center' class="deviceTdTitle"><strong>ID</strong></td>
- <td align='center' class="deviceTdTitle"><strong>用户名</strong></td>
- <td width='100' align='center' class="deviceTdTitle">状态</td>
- <td width='300' align='center' class="deviceTdTitle"><strong>操作选项</strong></td>
- </tr>
- <%
- If rsu.BOF And rsu.EOF Then
- Response.Write "<tr><td colspan='10' height='50' align='center'>没有任何用户</td></tr>"
- Else
- Do While Not rsu.EOF
- if rsu("id") = 1 then
- else
- %>
- <tr class='deviceTd'>
- <td width='30' align='center'><%=rsu("id")%></td>
- <td><%
- Response.Write "<a href='admin_user.asp?Action=Modify&uid=" & rsu("uid") & "'>" & rsu("uid") & "</a>"
- 'Response.Write " " & rsu("t_classid") & "," & rsu("PrevID") & "," & rsu("NextID") & "," & rsu("ParentID") & "," & rsu("RootID")
- %> </td>
- <td align='center'><%if rsu("status") = 0 then response.write "<span style='color:green'>正常</span>" else response.write "<span style='color:red'>禁用</span>"%></td>
- <%
- if lcase(trim(AdminName)) <> "admin" and lcase(trim(rsu("uid"))) = "admin" then
- response.write "<td align='center'></td>"
- else
- %>
- <td align='center'> <a href='admin_user.asp?ChannelID=<%=ChannelID%>&Action=Modify&uid=<%=rsu("uid")%>'>修改信息</a>
- <%if trim(lcase(AdminName)) <> trim(lcase(rsu("uid"))) then%>
- | <a href='admin_user.asp?Action=Del&uid=<%=rsu("uid")%>' onClick='return ConfirmDel();'>删除</a>
- <%end if%> </td>
- <%end if%>
- </tr>
- <%
- end if
- rsu.MoveNext
- Loop
- End If
- rsu.Close
- Set rsu = Nothing
- %>
- </table>
-
- <table width='100%'><tr><form name='form1' action='admin_user.asp' method='post'><td align='center'></td></form></tr></table>
- <script language='JavaScript' type='text/JavaScript'>
- function ConfirmDel(){
- alert('确实要删除此用户吗?');}
- </script>
- <br>
- <%
- End Sub
- Sub AddUser()
- %>
- <br><table width='100%'><tr><td align='left'>您现在的位置:<a href='admin_user.asp?ChannelID=<%=ChannelID%>'>用户管理</a> >> 添加用户</td></tr></table>
- <form name='form1' method='post' action='admin_user.asp' onsubmit='return check()'>
- <table width='100%' border='0' align='center' cellpadding='5' cellspacing='1' class='border'><tr class='tdbg'><td height='100' valign='top'>
- <table width='95%' align='center' cellpadding='2' cellspacing='1' bgcolor='#CCCCCC'>
-
- <tr class='deviceTd'>
- <td width='106' class='tdbg5'><strong>用户名称:</strong></td>
- <td width="601" colspan="3"><input name='UserName' type='text' size='20' maxlength='80'> <font color=red>*</font></td>
- </tr>
- <tr class='deviceTd'>
- <td class='tdbg5'><strong>用户密码:</strong></td>
- <td colspan="3"><input name='pwd' type='password' id="pwd" size='20' maxlength='80' />
- <font color="red">*</font></td>
- </tr>
- <tr class='deviceTd'>
- <td class='tdbg5'><strong>确认密码:</strong></td>
- <td colspan="3"><input name='cpwd' type='password' id="cpwd" size='20' maxlength='80' />
- <font color="red">*</font></td>
- </tr>
- <tr class='deviceTd'>
- <td valign="top" class='tdbg5'><strong>状态:</strong></td>
- <td colspan="3"><label>
- <input type="checkbox" name="status" id="status" />
- 禁用</label></td>
- </tr>
- <tr class='deviceTd'>
- <td valign="top" class='tdbg5'><strong>电话:</strong></td>
- <td><input name='tel' type='text' id="tel" size='20' maxlength='80' /></td>
- <td><strong>手机:</strong></td>
- <td><input name='mobiletel' type='text' id="mobiletel" size='20' maxlength='80' /></td>
- </tr>
- <tr class='deviceTd'>
- <td valign="top" class='tdbg5'><strong>传真:</strong></td>
- <td><input name='fax' type='text' id="fax" size='20' maxlength='80' /></td>
- <td><strong>Email:</strong></td>
- <td><input name='email' type='text' id="email" size='20' maxlength='80' /></td>
- </tr>
- <tr class='deviceTd'>
- <td width='106' valign="top" class='tdbg5'><strong>设备权限:</strong></td>
- <td colspan="3">
- <%
- dim rsequiplist, sql, i, rc
- i = 1
- sql = "select uid, devicename from t_dev_property order by id"
- set rsequiplist = server.CreateObject("adodb.recordset")
- rsequiplist.open sql, conn, 1, 1
- if rsequiplist.bof and rsequiplist.eof then
- response.write "没有设备"
- else
- %>
- <table width="300" border="0" cellspacing="0" cellpadding="0" id="purview">
- <%do while not rsequiplist.eof%>
- <tr>
- <td width="26"> </td>
- <td>
- <label style="cursor:pointer">
- <input type="checkbox" name="e<%=i%>" id="e<%=i%>" value="<%=rsequiplist("uid")%>" />
- <%=rsequiplist("devicename")%></label> </td>
- </tr>
- <%
- i = i + 1
- rsequiplist.movenext
- loop
- end if
- rc = rsequiplist.recordcount
- rsequiplist.close
- set rsequiplist = nothing
- %>
- </table></td>
- </tr>
- </table>
- </td></tr></table>
- <table width='100%' border='0' align='center'>
- <tr class='tdbg'>
- <td height='40' colspan='2' align='center'>
- <input name='Action' type='hidden' id='Action' value='SaveAdd'>
- <input name='rc' type="hidden" id="rc" value="<%=rc%>" />
- <input name='Add' type='submit' value=' 添 加 ' style='cursor:hand;'> <input name='Cancel' type='button' id='Cancel' value=' 取 消 ' onClick="window.location.href='admin_user.asp?ChannelID=<%=ChannelID%>'" style='cursor:hand;'> </td>
- </tr>
- </table>
- </form>
- <%
- Call WriteJS
- End Sub
- Sub WriteJS()
- %>
- <script language='JavaScript' type='text/JavaScript'>
- function check(){
- if (document.form1.UserName.value==''){
- alert('用户名称不能为空!');
- document.form1.UserName.focus();
- return false;}
- if(document.form1.pwd.value == ''){
- alert('密码不能为空!');
- document.form1.pwd.focus();
- return false;}
- if(document.form1.cpwd.value == ''){
- alert('确认密码不能为空!');
- document.form1.cpwd.focus();
- return false;}
- if(document.form1.pwd.value != document.form1.cpwd.value){
- alert('两次输入的密码不同!');
- document.form1.pwd.focus();
- return false;}
- }
- function showPurview(v){
- if (v == 1){
- document.getElementById("purview").style.display = 'none';
- }else if (v == 18){
- document.getElementById("purview").style.display = '';
- }else{
- document.getElementById("purview").style.display = 'none';
- }
- }
- </script>
- <%
- 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
- %>
- <br><table width='100%'><tr><td align='left'>您现在的位置:<a href='admin_user.asp?ChannelID=<%=ChannelID%>'>用户管理</a> >> 修改用户信息</td></tr></table>
- <form name='form1' method='post' action='admin_user.asp' onsubmit='return check()'>
- <table width='100%' border='0' align='center' cellpadding='5' cellspacing='1' class='border'><tr class='tdbg'><td height='100' valign='top'>
- <table width='95%' align='center' cellpadding='2' cellspacing='1' bgcolor='#CCCCCC'>
-
- <tr class='deviceTd'>
- <td width='106' class='tdbg5'><strong>用户名称:</strong></td>
- <td width="601" colspan="3"><%=rs("uid")%></td>
- </tr>
- <tr class='deviceTd'>
- <td class='tdbg5'><strong>用户密码:</strong></td>
- <td colspan="3"><input name='pwd' type='password' id="pwd" size='20' maxlength='80' /></td>
- </tr>
- <tr class='deviceTd'>
- <td class='tdbg5'><strong>确认密码:</strong></td>
- <td colspan="3"><input name='cpwd' type='password' id="cpwd" size='20' maxlength='80' /></td>
- </tr>
- <tr class='deviceTd'>
- <td valign="top" class='tdbg5'> </td>
- <td colspan="3"><label>
- <input name="mpwd" type="checkbox" id="mpwd" value="yes" />
- <span style="color:red">修改密码(如需修改密码请勾选此项)</span></label></td>
- </tr>
- <tr class='deviceTd'>
- <td valign="top" class='tdbg5'><strong>状态:</strong></td>
- <td colspan="3"><label>
- <input type="checkbox" name="status" id="status" <%if rs("status") = 1 then response.write "checked"%> />
- 禁用</label></td>
- </tr>
- <tr class='deviceTd'>
- <td valign="top" class='tdbg5'><strong>电话:</strong></td>
- <td><input name='tel' type='text' id="tel" size='20' maxlength='80' value="<%=rs("tel")%>" /></td>
- <td><strong>手机:</strong></td>
- <td><input name='mobiletel' type='text' id="mobiletel" size='20' maxlength='80' value="<%=rs("mobiletel")%>" /></td>
- </tr>
- <tr class='deviceTd'>
- <td valign="top" class='tdbg5'><strong>传真:</strong></td>
- <td><input name='fax' type='text' id="fax" size='20' maxlength='80' value="<%=rs("fax")%>" /></td>
- <td><strong>Email:</strong></td>
- <td><input name='email' type='text' id="email" size='20' maxlength='80' value="<%=rs("email")%>" /></td>
- </tr>
- <tr class='deviceTd' style='display:<%if trim(Lcase(uid)) = "admin" then response.write "none"%>;'>
- <td width='106' valign="top" class='tdbg5'><strong>设备权限:</strong></td>
- <td colspan="3">
- <%
- dim rsequiplist, sql, i, rc
- i = 1
- sql = "select uid, devicename from t_dev_property order by id"
- set rsequiplist = server.CreateObject("adodb.recordset")
- rsequiplist.open sql, conn, 1, 1
- if rsequiplist.bof and rsequiplist.eof then
- response.write "没有设备"
- else
- %>
- <table width="300" border="0" cellspacing="0" cellpadding="0" id="purview">
- <%do while not rsequiplist.eof%>
- <tr>
- <td width="26"> </td>
- <td>
- <%
- set rs3 = conn.execute("select * from t_role_equip where uid = '"&rsequiplist("uid")&"' and userid = '"&uid&"'")
- if rs3.bof and rs3.eof then isChecked = "" else isChecked = "checked"
- %>
- <label style="cursor:pointer">
- <input type="checkbox" name="e<%=i%>" id="e<%=i%>" value="<%=rsequiplist("uid")%>" <%=isChecked%> />
- <%=rsequiplist("devicename")%></label> </td>
- </tr>
- <%
- i = i + 1
- rsequiplist.movenext
- loop
- end if
- rc = rsequiplist.recordcount
- rsequiplist.close
- set rsequiplist = nothing
- %>
- </table></td>
- </tr>
- </table>
- </td></tr></table>
- <table width='100%' border='0' align='center'>
- <tr class='tdbg'>
- <td height='40' colspan='2' align='center'>
- <input name='Action' type='hidden' id='Action' value='SaveModify'>
- <input name='rc' type='hidden' id='rc' value='<%=rc%>'>
- <input name='UserName' id='UserName' type='hidden' value='<%=uid%>' />
- <input name='Add' type='submit' value=' 修 改 ' style='cursor:hand;'> <input name='Cancel' type='button' id='Cancel' value=' 取 消 ' onClick="window.location.href='admin_user.asp'" style='cursor:hand;'> </td>
- </tr>
- </table>
- </form>
- <%
- Call WriteJS2
- End Sub
- Sub WriteJS2()
- %>
- <script language='JavaScript' type='text/JavaScript'>
- function check(){
- if (document.form1.UserName.value==''){
- alert('用户名称不能为空!');
- document.form1.UserName.focus();
- return false;}
- if(document.form1.pwd.value != document.form1.cpwd.value){
- alert('两次输入的密码不同!');
- document.form1.pwd.focus();
- return false;}
- }
- function showPurview(v){
- if (v == 1){
- document.getElementById("purview").style.display = 'none';
- }else if (v == 18){
- document.getElementById("purview").style.display = '';
- }else{
- document.getElementById("purview").style.display = 'none';
- }
- }
- </script>
- <%
- 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
- %>
- </p>
- <p> </p> </td>
- </tr>
- </table></td>
- </tr>
- <tr>
- <td> </td>
- </tr>
- </table>
- </body>
- </html>
- <%
- Call CloseConn
- %>
|