AdminEdit.asp
上传用户:dbstep
上传日期:2022-08-06
资源大小:2803k
文件大小:19k
源码类别:

WEB源码(ASP,PHP,...)

开发平台:

ASP/ASPX

  1. <HTML xmlns="http://www.w3.org/1999/xhtml">
  2. <HEAD>
  3. <META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=utf-8" />
  4. <TITLE>编辑管理员</TITLE>
  5. <link rel="stylesheet" href="Images/CssAdmin.css">
  6. <script language="javascript" src="../skweb/JS/Admin.js"></script>
  7. </HEAD>
  8. <!--#include file="../skweb/Const.asp" -->
  9. <!--#include file="../skweb/ConnSiteData.asp" -->
  10. <!--#include file="../skweb/Md5.asp"-->
  11. <!--#include file="CheckAdmin.asp"-->
  12. <%
  13. if Instr(session("AdminPurview"),"|101,")=0 then 
  14.   response.write ("<font color='red')>你不具有该管理模块的操作权限,请返回!</font>")
  15.   response.end
  16. end if
  17. '========判断是否具有管理权限
  18. %>
  19. <BODY>
  20. <% 
  21. dim Result
  22. Result=request.QueryString("Result")
  23. dim ID,AdminName,Working,Password,vPassword,UserName,Purview,Explain,AddTime
  24. ID=request.QueryString("ID")
  25. if ID="" then ID=0
  26. call AdminEdit() 
  27. %>
  28. <!--#include file="conn/1top.asp"-->
  29. <table width="100%" border="0" cellpadding="5" cellspacing="1" bgcolor="#CCCCCC">
  30.   <tr>
  31.     <td height="29" nowrap background="Images/menutitle.gif"><font color="#FFFFFF">&nbsp;</font><strong>网站管理员:添加,修改管理员信息</strong></td>
  32.   </tr>
  33.   <tr>
  34.     <td height="24" align="center" nowrap  bgcolor="#EBF2F9"><a href="AdminEdit.asp?Result=Add" onClick='changeAdminFlag("添加管理员")'>添加管理员</a>&nbsp;|<font color="#0000FF">&nbsp;</font><a href="AdminList.asp" onClick='changeAdminFlag("网站管理员")'>查看所有管理员</a></td>
  35.   </tr>
  36. </table>
  37. <br>
  38. <table width="100%" border="0" cellpadding="3"  >
  39.   <form name="editForm" method="post" action="AdminEdit.asp?Action=SaveEdit&Result=<%=Result%>&ID=<%=ID%>" onSubmit="return CheckAdminEdit()">
  40.   <tr>
  41.     <td height="24" nowrap bgcolor="#EBF2F9"><table width="100%" border="0" cellpadding="5" cellspacing="1" bgcolor="#CCCCCC" id=editProduct idth="100%">
  42.       <tr>
  43.         <td width="120" height="20" align="right" bgcolor="#FFFFFF">&nbsp;</td>
  44.         <td bgcolor="#FFFFFF">&nbsp;</td>
  45.       </tr>
  46.       <tr>
  47.         <td height="20" align="right" bgcolor="#FFFFFF">登&nbsp;录&nbsp;名:</td>
  48.         <td bgcolor="#FFFFFF"><input name="AdminName" type="text" class="textfield" id="AdminName" style="WIDTH: 120;" value="<%=AdminName%>" maxlength="16" <%if Result="Modify" then response.write ("readonly")%>>&nbsp;*&nbsp;3-10位字符,不可修改</td>
  49.       </tr>
  50.       <tr>
  51.         <td height="20" align="right" bgcolor="#FFFFFF">生  效:</td>
  52.         <td bgcolor="#FFFFFF"><input name="Working" type="checkbox" value="1" style="HEIGHT: 13px;WIDTH: 13px;" <%if Working then response.write ("checked")%>></td>
  53.       </tr>
  54.       <tr>
  55.         <td height="20" align="right" bgcolor="#FFFFFF">密  码:</td>
  56.         <td bgcolor="#FFFFFF"><input name="Password" type="password" class="textfield" id="Password" maxlength="20" style="WIDTH: 120;">&nbsp;*&nbsp;6-16位字符,不填表未修改密码</td>
  57.       </tr>
  58.       <tr>
  59.         <td height="20" align="right" bgcolor="#FFFFFF">确认密码:</td>
  60.         <td bgcolor="#FFFFFF"><input name="vPassword" type="password" class="textfield" id="vPassword" maxlength="20" style="WIDTH: 120;">&nbsp;*</td>
  61.       </tr>
  62.       <tr>
  63.         <td height="20" align="right" bgcolor="#FFFFFF">管理员名:</td>
  64.         <td bgcolor="#FFFFFF"><input name="UserName" type="text" class="textfield" id="UserName" style="WIDTH: 120;" value="<%=UserName%>"></td>
  65.       </tr>
  66.       <tr>
  67.         <td height="20" align="right" bgcolor="#FFFFFF">选  择:</td>
  68.         <td bgcolor="#FFFFFF"><input onClick="CheckAll(this.form)" name="buttonAllSelect" type="button" class="button"  id="submitAllSearch" value="全" style="HEIGHT: 18px;WIDTH: 16px;">
  69.       <input onClick="CheckOthers(this.form)" name="buttonOtherSelect" type="button" class="button"  id="submitOtherSelect" value="反" style="HEIGHT: 18px;WIDTH: 16px;"></td>
  70.       </tr>
  71.       <tr >
  72.         <td height="20" align="right" bgcolor="#FFFFFF">操作权限:</td>
  73.         <td nowrap bgcolor="#FFFFFF">
  74.   <input name="Purview11" type="checkbox" value="|11," style="HEIGHT: 13px;WIDTH: 13px;"
  75.   <%if Instr(Purview,"|11,")>0 then response.write ("checked")%>>&nbsp;编辑企业
  76.           <input name="Purview12" type="checkbox" value="|12," style="HEIGHT: 13px;WIDTH: 13px;"
  77.   <%if Instr(Purview,"|12,")>0 then response.write ("checked")%>>&nbsp;企业列表
  78.   <input name="Purview21" type="checkbox" value="|21," style="HEIGHT: 13px;WIDTH: 13px;"
  79.   <%if Instr(Purview,"|21,")>0 then response.write ("checked")%>>&nbsp;新闻类别
  80.   <input name="Purview22" type="checkbox" value="|22," style="HEIGHT: 13px;WIDTH: 13px;"
  81.   <%if Instr(Purview,"|22,")>0 then response.write ("checked")%>>&nbsp;新闻列表
  82.           <input name="Purview23" type="checkbox" value="|23," style="HEIGHT: 13px;WIDTH: 13px;"
  83.   <%if Instr(Purview,"|23,")>0 then response.write ("checked")%>>&nbsp;编辑新闻
  84.   <input name="Purview31" type="checkbox" value="|31," style="HEIGHT: 13px;WIDTH: 13px;"
  85.   <%if Instr(Purview,"|31,")>0 then response.write ("checked")%>>&nbsp;产品类别
  86.   <input name="Purview32" type="checkbox" value="|32," style="HEIGHT: 13px;WIDTH: 13px;"
  87.   <%if Instr(Purview,"|32,")>0 then response.write ("checked")%>>&nbsp;产品列表
  88.           <input name="Purview33" type="checkbox" value="|33," style="HEIGHT: 13px;WIDTH: 13px;"
  89.   <%if Instr(Purview,"|33,")>0 then response.write ("checked")%>>&nbsp;编辑产品</td>
  90.       </tr>
  91.       <tr >
  92.         <td height="20" align="right" bgcolor="#FFFFFF">&nbsp;</td>
  93.         <td bgcolor="#FFFFFF">
  94.   <input name="Purview51" type="checkbox" value="|51," style="HEIGHT: 13px;WIDTH: 13px;"
  95.   <%if Instr(Purview,"|51,")>0 then response.write ("checked")%>>&nbsp;下载类别
  96.   <input name="Purview52" type="checkbox" value="|52," style="HEIGHT: 13px;WIDTH: 13px;"
  97.   <%if Instr(Purview,"|52,")>0 then response.write ("checked")%>>&nbsp;下载列表
  98.           <input name="Purview53" type="checkbox" value="|53," style="HEIGHT: 13px;WIDTH: 13px;"
  99.   <%if Instr(Purview,"|53,")>0 then response.write ("checked")%>>&nbsp;编辑下载
  100.   <input name="Purview61" type="checkbox" value="|61," style="HEIGHT: 13px;WIDTH: 13px;"
  101.   <%if Instr(Purview,"|61,")>0 then response.write ("checked")%>>&nbsp;招聘列表
  102.   <input name="Purview62" type="checkbox" value="|62," style="HEIGHT: 13px;WIDTH: 13px;"
  103.   <%if Instr(Purview,"|62,")>0 then response.write ("checked")%>>&nbsp;编辑招聘
  104.   <input name="Purview41" type="checkbox" value="|41," style="HEIGHT: 13px;WIDTH: 13px;"
  105.   <%if Instr(Purview,"|41,")>0 then response.write ("checked")%>>&nbsp;投票管理
  106.   <input name="Purview72" type="checkbox" value="|72," style="HEIGHT: 13px;WIDTH: 13px;"
  107.   <%if Instr(Purview,"|72,")>0 then response.write ("checked")%>>图片管理
  108.           <input name="Purview73" type="checkbox" value="|73," style="HEIGHT: 13px;WIDTH: 13px;"
  109.   <%if Instr(Purview,"|73,")>0 then response.write ("checked")%>>文件管理
  110.   
  111.   </td>
  112.       </tr>
  113.       <tr >
  114.         <td height="20" align="right" bgcolor="#FFFFFF">&nbsp;</td>
  115.         <td bgcolor="#FFFFFF">
  116.   <input name="Purview71" type="checkbox" value="|71," style="HEIGHT: 13px;WIDTH: 13px;"
  117.   <%if Instr(Purview,"|71,")>0 then response.write ("checked")%>>IP封锁管理
  118.   <input name="Purview81" type="checkbox" value="|81," style="HEIGHT: 13px;WIDTH: 13px;"
  119.   <%if Instr(Purview,"|81,")>0 then response.write ("checked")%>>&nbsp;广告列表
  120.   <input name="Purview82" type="checkbox" value="|82," style="HEIGHT: 13px;WIDTH: 13px;"
  121.   <%if Instr(Purview,"|82,")>0 then response.write ("checked")%>>&nbsp;编辑广告
  122.   <input name="Purview91" type="checkbox" value="|91," style="HEIGHT: 13px;WIDTH: 13px;"
  123.   <%if Instr(Purview,"|91,")>0 then response.write ("checked")%>>&nbsp;留言列表
  124.   <input name="Purview92" type="checkbox" value="|92," style="HEIGHT: 13px;WIDTH: 13px;"
  125.   <%if Instr(Purview,"|92,")>0 then response.write ("checked")%>>&nbsp;编辑留言
  126.           <input name="Purview93" type="checkbox" value="|93," style="HEIGHT: 13px;WIDTH: 13px;"
  127.   <%if Instr(Purview,"|93,")>0 then response.write ("checked")%>>&nbsp;订单列表
  128.   <input name="Purview94" type="checkbox" value="|94," style="HEIGHT: 13px;WIDTH: 13px;"
  129.   <%if Instr(Purview,"|94,")>0 then response.write ("checked")%>>&nbsp;订单回复
  130.   <input name="Purview97" type="checkbox" value="|97," style="HEIGHT: 13px;WIDTH: 13px;"
  131.   <%if Instr(Purview,"|97,")>0 then response.write ("checked")%>>&nbsp;人才列表
  132.   </td>
  133.       </tr>
  134.       <tr >
  135.         <td height="20" align="right" bgcolor="#FFFFFF">&nbsp;</td>
  136.         <td bgcolor="#FFFFFF">
  137.   <input name="Purview98" type="checkbox" value="|98," style="HEIGHT: 13px;WIDTH: 13px;"
  138.   <%if Instr(Purview,"|98,")>0 then response.write ("checked")%>>&nbsp;回复人才      
  139.   <input name="Purview101" type="checkbox" value="|101," style="HEIGHT: 13px;WIDTH: 13px;"
  140.   <%if Instr(Purview,"|101,")>0 then response.write ("checked")%>>&nbsp;编辑管理员
  141.   <input name="Purview102" type="checkbox" value="|102," style="HEIGHT: 13px;WIDTH: 13px;"
  142.   <%if Instr(Purview,"|102,")>0 then response.write ("checked")%>>&nbsp;管理员列表
  143.           <input name="Purview103" type="checkbox" value="|103," style="HEIGHT: 13px;WIDTH: 13px;"
  144.   <%if Instr(Purview,"|103,")>0 then response.write ("checked")%>>&nbsp;编辑会员
  145.           <input name="Purview119" type="checkbox" value="|119," style="HEIGHT: 13px;WIDTH: 13px;"
  146.   <%if Instr(Purview,"|119,")>0 then response.write ("checked")%>>&nbsp;友情链接
  147.           <input name="Purview120" type="checkbox" value="|120," style="HEIGHT: 13px;WIDTH: 13px;"
  148.   <%if Instr(Purview,"|120,")>0 then response.write ("checked")%>>&nbsp;SQL注入记录
  149.   <input name="Purview104" type="checkbox" value="|104," style="HEIGHT: 13px;WIDTH: 13px;"
  150.   <%if Instr(Purview,"|104,")>0 then response.write ("checked")%>>&nbsp;会员列表
  151.   </td>
  152.       </tr>
  153.       <tr >
  154.         <td height="20" align="right" bgcolor="#FFFFFF">&nbsp;</td>
  155.         <td bgcolor="#FFFFFF">
  156.   <input name="Purview105" type="checkbox" value="|105," style="HEIGHT: 13px;WIDTH: 13px;"
  157.   <%if Instr(Purview,"|105,")>0 then response.write ("checked")%>>&nbsp;会员组别
  158.   <input name="Purview111" type="checkbox" value="|111," style="HEIGHT: 13px;WIDTH: 13px;"
  159.   <%if Instr(Purview,"|111,")>0 then response.write ("checked")%>>&nbsp;修改密码
  160.   <input name="Purview112" type="checkbox" value="|112," style="HEIGHT: 13px;WIDTH: 13px;"
  161.   <%if Instr(Purview,"|112,")>0 then response.write ("checked")%>>&nbsp;网站信息设置
  162.   <input name="Purview113" type="checkbox" value="|113," style="HEIGHT: 13px;WIDTH: 13px;"
  163.   <%if Instr(Purview,"|113,")>0 then response.write ("checked")%>>&nbsp;导航栏目      
  164.   <input name="Purview114" type="checkbox" value="|114," style="HEIGHT: 13px;WIDTH: 13px;"
  165.   <%if Instr(Purview,"|114,")>0 then response.write ("checked")%>>&nbsp;常量设置
  166.   <input name="Purview115" type="checkbox" value="|115," style="HEIGHT: 13px;WIDTH: 13px;"
  167.   <%if Instr(Purview,"|115,")>0 then response.write ("checked")%>>&nbsp;数据库操作          
  168.   </td>
  169.       </tr>
  170.       <tr >
  171.         <td height="20" align="right" bgcolor="#FFFFFF">&nbsp;</td>
  172.         <td bgcolor="#FFFFFF">&nbsp;</td>
  173.       </tr>
  174.       <tr>
  175.         <td height="20" align="right" valign="top" bgcolor="#FFFFFF">备注说明:</td>
  176.         <td bgcolor="#FFFFFF"><textarea name="Explain" cols="88" rows="3" class="textfield" id="Explain" style="WIDTH: 580;" ><%=Explain%></textarea></td>
  177.       </tr>
  178.       <tr>
  179.         <td height="30" align="right" bgcolor="#FFFFFF">&nbsp;</td>
  180.         <td valign="bottom" bgcolor="#FFFFFF"><input name="submitSaveEdit" type="submit" class="button"  id="submitSaveEdit" value="保存" style="WIDTH: 60;" ></td>
  181.       </tr>
  182.       <tr>
  183.         <td height="20" align="right" bgcolor="#FFFFFF">&nbsp;</td>
  184.         <td valign="bottom" bgcolor="#FFFFFF">&nbsp;</td>
  185.       </tr>
  186.     </table></td>
  187.   </tr>
  188.   </form>
  189. </table>
  190. </BODY>
  191. </HTML>
  192. <%
  193. sub AdminEdit()
  194.   dim Action,rsCheckAdd,rs,sql
  195.   Action=request.QueryString("Action")
  196.   if Action="SaveEdit" then '保存编辑管理员信息
  197.     set rs = server.createobject("adodb.recordset")
  198.     if Result="Add" then '创建网站管理员
  199.       set rsCheckAdd = conn.execute("select AdminName from sk_Admin where AdminName='" & trim(Request.Form("AdminName")) & "'")
  200.       if not (rsCheckAdd.bof and rsCheckAdd.eof) then '判断此管理员名是否存在
  201.         response.write "<script language=javascript> alert('" & trim(Request.Form("AdminName")) & "管理员已经存在,请换一个登录名再试试!');history.back(-1);</script>"
  202.         response.end
  203.       end if  
  204.   sql="select * from sk_Admin"
  205.       rs.open sql,conn,1,3
  206.       rs.addnew
  207.       if len(trim(Request.Form("AdminName")))<3 or len(trim(Request.Form("Password")))>10  then
  208.         response.write "<script language=javascript> alert('管理员登录名必填,且字符数为3-10位!');history.back(-1);</script>"
  209.         response.end
  210.       end if   
  211.       if len(trim(Request.Form("Password")))<6 or len(trim(Request.Form("Password")))>16  then
  212.         response.write "<script language=javascript> alert('管理员密码必填,且字符数为6-16位!');history.back(-1);</script>"
  213.         response.end
  214.       end if
  215.   if Request.Form("Password")<>Request.Form("vPassword") then 
  216.         response.write "<script language=javascript> alert('两次输入的密码不一样!');history.back(-1);</script>"
  217.         response.end
  218.   end if
  219.       rs("AdminName")=trim(Request.Form("AdminName"))
  220.   if Request.Form("Working")=1 then
  221.         rs("Working")=Request.Form("Working")
  222.   else
  223.         rs("Working")=0
  224.   end if
  225.   rs("Password")=Md5(Request.Form("Password"))
  226.   rs("UserName")=trim(Request.Form("UserName"))
  227.   rs("AdminPurview")=Request.Form("Purview11") & Request.Form("Purview12") &_
  228.                      Request.Form("Purview21") & Request.Form("Purview22") & Request.Form("Purview23") &_
  229.                      Request.Form("Purview31") & Request.Form("Purview32") & Request.Form("Purview33") &_
  230.                      Request.Form("Purview41") & Request.Form("Purview42") & Request.Form("Purview43") &_
  231.                      Request.Form("Purview51") & Request.Form("Purview52") & Request.Form("Purview53") &_
  232.                      Request.Form("Purview61") & Request.Form("Purview62") &_
  233.                      Request.Form("Purview71") & Request.Form("Purview72") & Request.Form("Purview73") &_
  234.                      Request.Form("Purview81") & Request.Form("Purview82") & Request.Form("Purview97") &_
  235.                      Request.Form("Purview91") & Request.Form("Purview92") & Request.Form("Purview93") &_
  236.                      Request.Form("Purview94") & Request.Form("Purview95") & Request.Form("Purview96") &_
  237.                      Request.Form("Purview98") & Request.Form("Purview98") & Request.Form("Purview101") &_
  238.                      Request.Form("Purview102") & Request.Form("Purview103") & Request.Form("Purview104") &_
  239.                      Request.Form("Purview105") & Request.Form("Purview111") & Request.Form("Purview112") &_
  240.                      Request.Form("Purview113") & Request.Form("Purview114") & Request.Form("Purview115") &_
  241.                      Request.Form("Purview116") & Request.Form("Purview117") & Request.Form("Purview118") &_
  242.                      Request.Form("Purview119") & Request.Form("Purview120")
  243.   rs("Explain")=trim(Request.Form("Explain"))
  244.   rs("AddTime")=now()
  245. end if  
  246. if Result="Modify" then '修改网站管理员
  247.       sql="select * from sk_Admin where ID="&ID
  248.       rs.open sql,conn,1,3
  249.       rs("AdminName")=trim(Request.Form("AdminName"))
  250.   if Request.Form("Working")=1 then
  251.         rs("Working")=Request.Form("Working")
  252.   else
  253.         rs("Working")=0
  254.   end if
  255.       if trim(Request.Form("Password"))<>"" then
  256.     if len(trim(Request.Form("Password")))<6 or len(trim(Request.Form("Password")))>20  then
  257.           response.write "<script language=javascript> alert('管理员密码必填,且字符数为6-20位!');history.back(-1);</script>"
  258.           response.end
  259.         end if
  260.     if Request.Form("Password")<>Request.Form("vPassword") then 
  261.           response.write "<script language=javascript> alert('两次输入的密码不一样!');history.back(-1);</script>"
  262.           response.end
  263.     end if
  264.     rs("Password")=Md5(Request.Form("Password"))
  265.   end if
  266.   rs("UserName")=trim(Request.Form("UserName"))
  267.   rs("AdminPurview")=Request.Form("Purview11") & Request.Form("Purview12") &_
  268.                      Request.Form("Purview21") & Request.Form("Purview22") & Request.Form("Purview23") &_
  269.                      Request.Form("Purview31") & Request.Form("Purview32") & Request.Form("Purview33") &_
  270.                      Request.Form("Purview41") & Request.Form("Purview42") & Request.Form("Purview43") &_
  271.                      Request.Form("Purview51") & Request.Form("Purview52") & Request.Form("Purview53") &_
  272.                      Request.Form("Purview61") & Request.Form("Purview62") &_
  273.                      Request.Form("Purview71") & Request.Form("Purview72") & Request.Form("Purview73") &_
  274.                      Request.Form("Purview81") & Request.Form("Purview82") & Request.Form("Purview97") &_
  275.                      Request.Form("Purview91") & Request.Form("Purview92") & Request.Form("Purview93") &_
  276.                      Request.Form("Purview94") & Request.Form("Purview95") & Request.Form("Purview96") &_
  277.                      Request.Form("Purview98") & Request.Form("Purview98") & Request.Form("Purview101") &_
  278.                      Request.Form("Purview102") & Request.Form("Purview103") & Request.Form("Purview104") &_
  279.                      Request.Form("Purview105") & Request.Form("Purview111") & Request.Form("Purview112") &_
  280.                      Request.Form("Purview113") & Request.Form("Purview114") & Request.Form("Purview115") &_
  281.                      Request.Form("Purview116") & Request.Form("Purview117") & Request.Form("Purview118") &_
  282.                      Request.Form("Purview119") & Request.Form("Purview120")
  283.   rs("Explain")=trim(Request.Form("Explain"))
  284. end if
  285. rs.update
  286. rs.close
  287.     set rs=nothing 
  288.     Response.Redirect("Tips/admin.asp")
  289.   else '提取管理员信息
  290. if Result="Modify" then
  291.       set rs = server.createobject("adodb.recordset")
  292.       sql="select * from sk_Admin where ID="& ID
  293.       rs.open sql,conn,1,1
  294.   AdminName=rs("AdminName")
  295.   Working=rs("Working")
  296.   UserName=rs("UserName")
  297.   Purview=rs("AdminPurview")
  298.   Explain=rs("Explain")
  299.   rs.close
  300.       set rs=nothing 
  301. end if
  302.   end if
  303. end sub
  304.   
  305. %>