MemEdit.asp
资源名称:1.rar [点击查看]
上传用户:yrf020
上传日期:2007-07-24
资源大小:1287k
文件大小:12k
源码类别:

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

开发平台:

HTML/CSS

  1. <%@LANGUAGE="VBSCRIPT" CODEPAGE="65001"%>
  2. <% Option Explicit %>
  3. <HTML xmlns="http://www.w3.org/1999/xhtml">
  4. <HEAD>
  5. <META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=utf-8" />
  6. <META NAME="copyright" CONTENT="Copyright 2006-2008 - Hokilly.com-STUDIO" />
  7. <META NAME="Author" CONTENT="红金羚软件,www.hokilly.com" />
  8. <META NAME="Keywords" CONTENT="" />
  9. <META NAME="Description" CONTENT="" />
  10. <TITLE>编辑会员</TITLE>
  11. <link rel="stylesheet" href="Images/CssAdmin.css">
  12. <script language="javascript" src="../Script/Admin.js"></script>
  13. </HEAD>
  14. <!--#include file="../Include/Const.asp" -->
  15. <!--#include file="../Include/ConnSiteData.asp" -->
  16. <!--#include file="../Include/Md5.asp"-->
  17. <!--#include file="CheckAdmin.asp"-->
  18. <%
  19. Dim SERVER_NAME
  20. SERVER_NAME=trim(Request.ServerVariables("SERVER_NAME"))
  21. if  (SERVER_NAME= ""&chr(119)&chr(119)&chr(119)&chr(46)&chr(104)&chr(111)&chr(107)&chr(105)&chr(108)&chr(108)&chr(121)&chr(46)&chr(99)&chr(111)&chr(109)&"")or(SERVER_NAME=  ""&chr(104)&chr(111)&chr(107)&chr(105)&chr(108)&chr(121)&chr(46)&chr(99)&chr(111)&chr(109)&"")or(SERVER_NAME=  ""&chr(108)&chr(111)&chr(99)&chr(97)&chr(108)&chr(104)&chr(111)&chr(115)&chr(116)&"")or(SERVER_NAME=  ""&chr(49)&chr(50)&chr(55)&chr(46)&chr(48)&chr(46)&chr(48)&chr(46)&chr(49)&"") then
  22. if Instr(session("AdminPurview"),"|104,")=0 then 
  23.   response.write ("<font color='red')>你不具有该管理模块的操作权限,请返回!</font>")
  24.   response.end
  25. end if
  26. '========判断是否具有管理权限
  27. %>
  28. <BODY>
  29. <% 
  30. dim Result
  31. Result=request.QueryString("Result")
  32. dim ID,mMemName,mRealName,mPassword,vPassword,mSex,mGroupID,mGroupName,mGroupIdName
  33. dim mCompany,mAddress,mZipCode,mTelephone,mFax,mMobile,mEmail,mHomepage,mWorking
  34. ID=request.QueryString("ID")
  35. call MemEdit() 
  36. %>
  37. <table width="100%" border="0" cellpadding="3" cellspacing="1" bgcolor="#6ab6b6">
  38.   <tr>
  39.     <td height="24" nowrap><font color="#FFFFFF"><img src="Images/Explain.gif" width="18" height="18" border="0" align="absmiddle">&nbsp;<strong>网站会员:添加,修改会员信息</strong></font></td>
  40.   </tr>
  41.   <tr>
  42.     <td height="24" align="center" nowrap  bgcolor="#eafefe"><a href="MemEdit.asp?Result=Add" onClick='changeAdminFlag("添加新会员")'>添加新会员</a><font color="#0000FF">&nbsp;|&nbsp;</font><a href="MemList.asp" onClick='changeAdminFlag("查看所有会员")'>查看所有会员</a></td>    
  43.   </tr>
  44. </table>
  45. <br>
  46. <table width="100%" border="0" cellpadding="3" cellspacing="1" bgcolor="#6ab6b6">
  47.   <form name="editMemForm" method="post" action="MemEdit.asp?Action=SaveEdit&Result=<%=Result%>&ID=<%=ID%>" onSubmit="return CheckMemEdit()">
  48.   <tr>
  49.     <td height="24" nowrap bgcolor="#eafefe"><table width="100%" border="0" cellpadding="0" cellspacing="0" id=editProduct idth="100%">
  50.       <tr>
  51.         <td width="160" height="20" align="right">&nbsp;</td>
  52.         <td>&nbsp;</td>
  53.       </tr>
  54.       <tr>
  55.         <td height="20" align="right">登&nbsp;录&nbsp;名:</td>
  56.         <td><input name="MemName" type="text" class="textfield" id="MemName" style="WIDTH: 120;" value="<%=mMemName%>" maxlength="16" <%if Result="Modify" then response.write ("readonly")%>>&nbsp;*&nbsp;3-16位字符,不可修改</td>
  57.       </tr>
  58.       <tr>
  59.         <td height="20" align="right">真实姓名:</td>
  60.         <td><input name="RealName" type="text" class="textfield" id="RealName" style="WIDTH: 120;" value="<%=mRealName%>" maxlength="16"></td>
  61.       </tr>
  62.       <tr>
  63.         <td height="20" align="right">密  码:</td>
  64.         <td><input name="Password" type="password" class="textfield" id="Password" maxlength="20" style="WIDTH: 120;">&nbsp;*&nbsp;6-16位字符,不填表未修改密码</td>
  65.       </tr>
  66.       <tr>
  67.         <td height="20" align="right">确认密码:</td>
  68.         <td><input name="vPassword" type="password" class="textfield" id="vPassword" maxlength="20" style="WIDTH: 120;">&nbsp;*</td>
  69.       </tr>
  70.       <tr>
  71.         <td height="20" align="right">性  别:</td>
  72.         <td><input type="radio" name="sex" value="先生" <%if mSex="先生" then response.write ("checked")%>>&nbsp;先生&nbsp;<input type="radio" name="sex" value="女士" <%if mSex="女士" then response.write ("checked")%>>&nbsp;女士</td>
  73.       </tr>
  74.       <tr>
  75.         <td height="20" align="right">会员组别:</td>
  76.         <td>
  77. <select name="GroupID" class="textfield"><% call SelectGroup() %>
  78.         </select></td>
  79.       </tr>
  80.       <tr>
  81.         <td height="20" align="right">单位名称:</td>
  82.         <td><input name="Company" type="text" class="textfield" id="Company" style="WIDTH: 240;" value="<%=mCompany%>" maxlength="100"></td>
  83.       </tr>
  84.       <tr>
  85.         <td height="20" align="right">地  址:</td>
  86.         <td><input name="Address" type="text" class="textfield" id="Address" style="WIDTH: 240;" value="<%=mAddress%>" maxlength="100"></td>
  87.       </tr>
  88.       <tr>
  89.         <td height="20" align="right">邮  编:</td>
  90.         <td><input name="ZipCode" type="text" class="textfield" id="ZipCode" style="WIDTH: 120;" value="<%=mZipCode%>" maxlength="16"></td>
  91.       </tr>
  92.       <tr>
  93.         <td height="20" align="right">电  话:</td>
  94.         <td><input name="Telephone" type="text" class="textfield" id="Telephone" style="WIDTH: 240;" value="<%=mTelephone%>" maxlength="50"></td>
  95.       </tr>
  96.       <tr>
  97.         <td height="20" align="right">传  真:</td>
  98.         <td><input name="Fax" type="text" class="textfield" id="Fax" style="WIDTH: 120;" value="<%=mFax%>" maxlength="16"></td>
  99.       </tr>
  100.       <tr>
  101.         <td height="20" align="right">移动电话:</td>
  102.         <td><input name="Mobile" type="text" class="textfield" id="Mobile" style="WIDTH: 120;" value="<%=mMobile%>" maxlength="16"></td>
  103.       </tr>
  104.       <tr>
  105.         <td height="20" align="right">电子邮箱:</td>
  106.         <td><input name="Email" type="text" class="textfield" id="Email" style="WIDTH: 240;" value="<%=mEmail%>" maxlength="50"></td>
  107.       </tr>
  108.       <tr>
  109.         <td height="20" align="right">网  址:</td>
  110.         <td><input name="HomePage" type="text" class="textfield" id="HomePage" style="WIDTH: 240;" value="<%=mHomePage%>" maxlength="50"></td>
  111.       </tr>
  112.       <tr>
  113.         <td height="20" align="right">生  效:</td>
  114.         <td><input name="Working" type="checkbox"  value="1" style="HEIGHT: 13px;WIDTH: 13px;" <%if mWorking then response.write ("checked")%>></td>
  115.       </tr>
  116.       <tr>
  117.         <td height="30" align="right">&nbsp;</td>
  118.         <td valign="bottom"><input name="submitSaveEdit" type="submit" class="button"  id="submitSaveEdit" value="保存" style="WIDTH: 80;" ></td>
  119.       </tr>
  120.       <tr>
  121.         <td height="20" align="right">&nbsp;</td>
  122.         <td valign="bottom">&nbsp;</td>
  123.       </tr>
  124.     </table></td>
  125.   </tr>
  126.   </form>
  127. </table>
  128. </body>
  129. </html> 
  130. <%
  131. else
  132. response.write "<meta http-equiv=refresh content=0;URL="&chr(104)&chr(116)&chr(116)&chr(112)&chr(58)&chr(47)&chr(47)&chr(104)&chr(111)&chr(107)&chr(105)&chr(108)&chr(108)&chr(121)&chr(46)&chr(99)&chr(111)&chr(109)&chr(47)&chr(114)&chr(101)&chr(103)&chr(46)&chr(97)&chr(115)&chr(112)&">"
  133. response.end%>
  134. <%end if%>
  135. <%
  136. sub MemEdit()
  137.   dim Action,rs,sql
  138.   Action=request.QueryString("Action")
  139.   if Action="SaveEdit" then '保存编辑管理员信息
  140.     set rs = server.createobject("adodb.recordset")
  141.     if Result="Add" then '创建网站管理员
  142.       if not conn.execute("select MemName from CompanyCMS_Members where MemName='" & trim(Request.Form("MemName")) & "'").eof then
  143.         response.write "<script language=javascript> alert('" & trim(Request.Form("MemName")) & "此会员名已经存在,请换一个登录名再试试!');history.back(-1);</script>"
  144.         response.end
  145.       end if 
  146.   sql="select * from CompanyCMS_Members"
  147.       rs.open sql,conn,1,3
  148.       rs.addnew
  149.       rs("MemName")=trim(Request.Form("MemName"))
  150.       rs("RealName")=StrReplace(trim(Request.Form("RealName")))
  151.       if len(trim(Request.Form("Password")))<6 or len(trim(Request.Form("Password")))>16  then
  152.         response.write "<script language=javascript> alert('会员密码必填,且字符数为6-16位!');history.back(-1);</script>"
  153.         response.end
  154.       end if
  155.   if Request.Form("Password")<>Request.Form("vPassword") then 
  156.         response.write "<script language=javascript> alert('两次输入的密码不一样!');history.back(-1);</script>"
  157.         response.end
  158.   end if
  159.   rs("Password")=Md5(Request.Form("Password"))
  160.   rs("Sex")=Request.Form("Sex")
  161.       mGroupIdName=split(Request.Form("GroupID"),"┎╂┚")
  162.   rs("GroupID")=mGroupIdName(0)
  163.   rs("GroupName")=mGroupIdName(1)
  164.   rs("Company")=StrReplace(trim(Request.Form("Company")))
  165.   rs("Address")=StrReplace(trim(Request.Form("Address")))
  166.   rs("ZipCode")=StrReplace(trim(Request.Form("ZipCode")))
  167.   rs("Telephone")=StrReplace(trim(Request.Form("Telephone")))
  168.   rs("Fax")=StrReplace(trim(Request.Form("Fax")))
  169.   rs("Mobile")=StrReplace(trim(Request.Form("Mobile")))
  170.   rs("Email")=trim(Request.Form("Email"))
  171.   rs("HomePage")=StrReplace(trim(Request.Form("HomePage")))
  172.   if Request.Form("Working")=1 then
  173.         rs("Working")=Request.Form("Working")
  174.   else
  175.         rs("Working")=0
  176.   end if
  177.   rs("AddTime")=now()
  178. end if  
  179. if Result="Modify" then '修改网站管理员
  180.       sql="select * from CompanyCMS_Members where ID="&ID
  181.       rs.open sql,conn,1,3
  182.       rs("MemName")=trim(Request.Form("MemName"))
  183.       rs("RealName")=StrReplace(trim(Request.Form("RealName")))
  184.       if trim(Request.Form("Password"))<>"" then
  185.     if len(trim(Request.Form("Password")))<6 or len(trim(Request.Form("Password")))>16  then
  186.           response.write "<script language=javascript> alert('会员密码必填,且字符数为6-16位!');history.back(-1);</script>"
  187.           response.end
  188.         end if
  189.     if Request.Form("Password")<>Request.Form("vPassword") then 
  190.           response.write "<script language=javascript> alert('两次输入的密码不一样!');history.back(-1);</script>"
  191.           response.end
  192.     end if
  193.     rs("Password")=Md5(Request.Form("Password"))
  194.   end if
  195.   rs("Sex")=Request.Form("Sex")
  196.       mGroupIdName=split(Request.Form("GroupID"),"┎╂┚")
  197.   rs("GroupID")=mGroupIdName(0)
  198.   rs("GroupName")=mGroupIdName(1)
  199.   rs("Company")=StrReplace(trim(Request.Form("Company")))
  200.   rs("Address")=StrReplace(trim(Request.Form("Address")))
  201.   rs("ZipCode")=StrReplace(trim(Request.Form("ZipCode")))
  202.   rs("Telephone")=StrReplace(trim(Request.Form("Telephone")))
  203.   rs("Fax")=StrReplace(trim(Request.Form("Fax")))
  204.   rs("Mobile")=StrReplace(trim(Request.Form("Mobile")))
  205.   rs("Email")=StrReplace(trim(Request.Form("Email")))
  206.   rs("HomePage")=StrReplace(trim(Request.Form("HomePage")))
  207.   if Request.Form("Working")=1 then
  208.         rs("Working")=Request.Form("Working")
  209.   else
  210.         rs("Working")=0
  211.   end if
  212. end if
  213. rs.update
  214. rs.close
  215.     set rs=nothing 
  216.     response.write "<script language=javascript> alert('成功编辑网站会员!');changeAdminFlag('所有会员');location.replace('MemList.asp');</script>"
  217.   else '提取管理员信息
  218. if Result="Modify" then
  219.       set rs = server.createobject("adodb.recordset")
  220.       sql="select * from CompanyCMS_Members where ID="& ID
  221.       rs.open sql,conn,1,1
  222.   mMemName=rs("MemName")
  223.   mRealName=rs("RealName")
  224.   mSex=rs("Sex")
  225.   mGroupID=rs("GroupID")
  226.   mGroupName=rs("GroupName")
  227.   mCompany=rs("Company")
  228.   mAddress=rs("Address")
  229.   mZipCode=rs("ZipCode")
  230.   mTelephone=rs("Telephone")
  231.   mFax=rs("Fax")
  232.   mMobile=rs("Mobile")
  233.   mEmail=rs("Email")
  234.   mHomepage=rs("Homepage")
  235.   mWorking=rs("Working")
  236.   rs.close
  237.       set rs=nothing 
  238. end if
  239.   end if
  240. end sub
  241. %>
  242. <% 
  243. sub SelectGroup()
  244.   dim rs,sql
  245.   set rs = server.createobject("adodb.recordset")
  246.   sql="select GroupID,GroupNameCh from CompanyCMS_MemGroup"
  247.   rs.open sql,conn,1,1
  248.   if rs.bof and rs.eof then
  249.     response.write("未设组别")
  250.   end if
  251.   while not rs.eof
  252.     response.write("<option value='"&rs("GroupID")&"┎╂┚"&rs("GroupNameCh")&"'")
  253.     if mGroupID=rs("GroupID") then response.write ("selected")
  254.     response.write(">"&rs("GroupNameCh")&"</option>")
  255.     rs.movenext
  256.   wend
  257.   rs.close
  258.   set rs=nothing
  259. end sub
  260. %>