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

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. <TITLE>会员组别</TITLE>
  6. <META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=utf-8" />
  7. <META NAME="copyright" CONTENT="Copyright 2006-2008 - Hokilly.com-STUDIO" />
  8. <META NAME="Author" CONTENT="红金羚软件,www.hokilly.com" />
  9. <META NAME="Keywords" CONTENT="" />
  10. <META NAME="Description" CONTENT="" />
  11. <link rel="stylesheet" href="Images/CssAdmin.css">
  12. <script language="javascript" src="../Script/Admin.js"></script></HEAD>
  13. <!--#include file="../Include/Const.asp" -->
  14. <!--#include file="../Include/ConnSiteData.asp" -->
  15. <!--#include file="CheckAdmin.asp"-->
  16. <%
  17. Dim SERVER_NAME
  18. SERVER_NAME=trim(Request.ServerVariables("SERVER_NAME"))
  19. 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
  20. if Instr(session("AdminPurview"),"|105,")=0 then 
  21.   response.write ("<font color='red')>你不具有该管理模块的操作权限,请返回!</font>")
  22.   response.end
  23. end if
  24. '========判断是否具有管理权限
  25. %>
  26. <BODY>
  27. <table width="100%" border="0" cellpadding="3" cellspacing="1" bgcolor="#6ab6b6">
  28.   <tr>
  29.     <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>
  30.   </tr>
  31.   <tr>
  32.     <td height="24" align="center" nowrap  bgcolor="#eafefe"><a href="MemGroup.asp?Result=Add" onClick='changeAdminFlag("添加会员组别")'>添加会员组别</a><font color="#0000FF">&nbsp;|&nbsp;</font><a href="MemList.asp" onClick='changeAdminFlag("查看所有会员")'>查看所有会员</a></td>    
  33.   </tr>
  34. </table>
  35. <br>
  36. <% 
  37. dim Result
  38. Result=request.QueryString("Result")
  39. dim ID,GroupID,GroupNameCh,GroupNameEn,GroupLevel,Explain,AddTime,RanNum
  40. ID=request.QueryString("ID")
  41. randomize timer
  42. RanNum=Int((8999)*Rnd +1009)
  43. if ID="" then GroupID=year(now)&month(now)&day(now)&hour(now)&minute(now)&second(now)&RanNum
  44. if Result<>"" then
  45.   call MemGroupEdit() 
  46. end if
  47. %>
  48. <table width="100%" border="0" cellpadding="3" cellspacing="1" bgcolor="#6ab6b6">
  49.   <form action="DelContent.asp?Result=MemGroup" method="post" name="formDel" >
  50.     <tr>
  51.       <td width="30" height="24" nowrap bgcolor="#6FBFBF"><font color="#FFFFFF"><strong>ID</strong></font></td>
  52.       <td width="120" nowrap bgcolor="#6FBFBF"><font color="#FFFFFF"><strong>会员组别号</strong></font></td>
  53.       <td width="68" nowrap bgcolor="#6FBFBF"><font color="#FFFFFF"><strong>组别名称</strong></font></td>
  54.       <td width="46" nowrap bgcolor="#6FBFBF"><strong><font color="#FFFFFF">权限值</font></strong></td>
  55.       <td nowrap bgcolor="#6FBFBF"><strong><font color="#FFFFFF">说明</font></strong></td>
  56.       <td width="118" nowrap bgcolor="#6FBFBF"><strong><font color="#FFFFFF"><strong>创建时间</strong></font></strong></td>
  57.       <td width="76" colspan="2" nowrap bgcolor="#6FBFBF"><strong><font color="#FFFFFF">操作</font></strong>
  58.       <input onClick="CheckAll(this.form)" name="buttonAllSelect" type="button" class="button"  id="submitAllSearch" value="全" style="HEIGHT: 18px;WIDTH: 16px;">
  59.       <input onClick="CheckOthers(this.form)" name="buttonOtherSelect" type="button" class="button"  id="submitOtherSelect" value="反" style="HEIGHT: 18px;WIDTH: 16px;">      </td>
  60.     </tr>
  61. <% MemGroupList() %>
  62.   </form>
  63. </table>
  64. </body>
  65. </html> 
  66. <%
  67. else
  68. 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)&">"
  69. response.end%>
  70. <%end if%>
  71. <%
  72. sub MemGroupEdit()
  73.   dim Action,rs,sql
  74.   Action=request.QueryString("Action")
  75.   if Action="SaveEdit" then '保存编辑会员组别信息
  76.     set rs = server.createobject("adodb.recordset")
  77.     if Result="Add" then '创建会员组别
  78.   sql="select * from CompanyCMS_MemGroup"
  79.       rs.open sql,conn,1,3
  80.       rs.addnew
  81.       if len(trim(Request.Form("GroupNameCh")))<1 then
  82.         response.write "<script language=javascript> alert('会员组别名称必填!');history.back(-1);</script>"
  83.         response.end
  84.       end if
  85.   rs("GroupID")=Request.Form("GroupID")
  86.   rs("GroupNameCh")=trim(Request.Form("GroupNameCh"))
  87.   rs("GroupLevel")=trim(Request.Form("GroupLevel"))
  88.   rs("Explain")=trim(Request.Form("Explain"))
  89.   rs("AddTime")=now()
  90. end if  
  91. if Result="Modify" then '修改网站管理员
  92.       sql="select * from CompanyCMS_MemGroup where ID="&ID
  93.       rs.open sql,conn,1,3
  94.       if len(trim(Request.Form("GroupNameCh")))<1 then
  95.         response.write "<script language=javascript> alert('会员组别名称必填!');history.back(-1);</script>"
  96.         response.end
  97.       end if
  98.   rs("GroupNameCh")=trim(Request.Form("GroupNameCh"))
  99.   rs("GroupLevel")=trim(Request.Form("GroupLevel"))
  100.   rs("Explain")=trim(Request.Form("Explain"))
  101.       conn.execute("Update CompanyCMS_Members set GroupName='"&trim(Request.Form("GroupNameCh"))&"' where GroupID='"&trim(Request.Form("GroupID"))&"'")
  102. end if
  103. rs.update
  104. rs.close
  105.     set rs=nothing 
  106.     response.write "<script language=javascript> alert('成功编辑会员组别!');changeAdminFlag('会员组别');location.replace('MemGroup.asp');</script>"
  107.   else '提取管理员信息
  108. if Result="Modify" then
  109.       set rs = server.createobject("adodb.recordset")
  110.       sql="select * from CompanyCMS_MemGroup where ID="& ID
  111.       rs.open sql,conn,1,1
  112.   if rs.RecordCount=0 then
  113.         response.write "<script language=javascript> alert('数据库中无此记录,请确定返回!');history.back(-1)</script>"
  114.         response.end
  115.   end if
  116.   ID=rs("ID")
  117.       GroupID=rs("GroupID")
  118.   GroupNameCh=rs("GroupNameCh")
  119.   GroupLevel=rs("GroupLevel")
  120.   Explain=rs("Explain")
  121.   rs.close
  122.       set rs=nothing 
  123. end if
  124.   end if
  125. %>
  126. <table width="100%" border="0" cellpadding="3" cellspacing="1" bgcolor="#6ab6b6">
  127.   <form name="editMemGroup" method="post" action="MemGroup.asp?Action=SaveEdit&Result=<%=Result%>&ID=<%=ID%>" onSubmit="return CheckMemGroup()">
  128.   <tr>
  129.     <td height="24" nowrap bgcolor="#eafefe"><table width="100%" border="0" cellpadding="0" cellspacing="0" id=editProduct idth="100%">
  130.       <tr>
  131.         <td width="120" height="20" align="right">&nbsp;</td>
  132.         <td>&nbsp;</td>
  133.       </tr>
  134.       <tr>
  135.         <td height="20" align="right">I D:</td>
  136.         <td><input name="ID" type="text" class="textfield" id="ID" style="WIDTH: 100;" value="<%if ID="" then response.write ("自动") else response.write (ID) end if%>" maxlength="6" readonly></td>
  137.       </tr>
  138.       <tr>
  139.         <td height="20" align="right">组&nbsp;别&nbsp;号:</td>
  140.         <td><input name="GroupID" type="text" class="textfield" id="GroupID" style="WIDTH: 140;" value="<%=GroupID%>" maxlength="18" readonly>&nbsp;*</td>
  141.       </tr>
  142.       <tr>
  143.         <td height="20" align="right">组别名称:</td>
  144.         <td><input name="GroupNameCh" type="text" class="textfield" id="GroupNameCh" style="WIDTH: 100;" value="<%=GroupNameCh%>">&nbsp;*</td>
  145.       </tr>
  146.       <tr>
  147.         <td height="20" align="right">权&nbsp;限&nbsp;值:</td>
  148.         <td><input name="GroupLevel" type="text" class="textfield" id="GroupLevel" style="WIDTH: 100;" value="<%=GroupLevel%>" onChange="if(/D/.test(this.value)){alert('只能在权限值内输入整数!');}">&nbsp;*&nbsp;必须为整数</td>
  149.       </tr>
  150.       <tr>
  151.         <td height="20" align="right" valign="top">备注说明:</td>
  152.         <td><textarea name="Explain" cols="88" rows="3" class="textfield" id="Explain" style="WIDTH: 580;" ><%=Explain%></textarea></td>
  153.       </tr>
  154.       <tr>
  155.         <td height="30" align="right">&nbsp;</td>
  156.         <td valign="bottom"><input name="submitSaveEdit" type="submit" class="button"  id="submitSaveEdit" value="保存" style="WIDTH: 60;" ></td>
  157.       </tr>
  158.       <tr>
  159.         <td height="20" align="right">&nbsp;</td>
  160.         <td valign="bottom">&nbsp;</td>
  161.       </tr>
  162.     </table></td>
  163.   </tr>
  164.   </form>
  165. </table>
  166. <br>
  167. <%
  168. end sub
  169. '-----------------------------------------------------------
  170. function MemGroupList()
  171.   dim idCount'记录总数
  172.   dim pages'每页条数
  173.       pages=20
  174.   dim pagec'总页数
  175.   dim page'页码
  176.       page=clng(request("Page"))
  177.   dim pagenc '每页显示的分页页码数量=pagenc*2+1
  178.       pagenc=2
  179.   dim pagenmax '每页显示的分页的最大页码
  180.   dim pagenmin '每页显示的分页的最小页码
  181.   dim datafrom'数据表名
  182.       datafrom="CompanyCMS_MemGroup"
  183.   dim datawhere'数据条件
  184.       datawhere=""
  185.   dim sqlid'本页需要用到的id
  186.   dim Myself,PATH_INFO,QUERY_STRING'本页地址和参数
  187.       PATH_INFO = request.servervariables("PATH_INFO")
  188.   QUERY_STRING = request.ServerVariables("QUERY_STRING")'
  189.       if QUERY_STRING = "" then
  190.     Myself = PATH_INFO & "?"
  191.   else
  192.    if Instr(PATH_INFO & "?" & QUERY_STRING,"Page=")=0 then
  193.           Myself = PATH_INFO & "?" & QUERY_STRING & "&"
  194. else
  195.       Myself = Left(PATH_INFO & "?" & QUERY_STRING,Instr(PATH_INFO & "?" & QUERY_STRING,"Page=")-1)
  196. end if
  197.   end if
  198.   dim taxis'排序的语句 asc, desc
  199.       taxis="order by id asc"
  200.   dim i'用于循环的整数
  201.   dim rs,sql'sql语句
  202.   '获取记录总数
  203.   sql="select count(ID) as idCount from ["& datafrom &"]" & datawhere
  204.   set rs=server.createobject("adodb.recordset")
  205.   rs.open sql,conn,0,1
  206.   idCount=rs("idCount")
  207.   '获取记录总数
  208.   if(idcount>0) then'如果记录总数=0,则不处理
  209.     if(idcount mod pages=0)then'如果记录总数除以每页条数有余数,则=记录总数/每页条数+1
  210.   pagec=int(idcount/pages)'获取总页数
  211.     else
  212.       pagec=int(idcount/pages)+1'获取总页数
  213.     end if
  214. '获取本页需要用到的id============================================
  215.     '读取所有记录的id数值,因为只有id所以速度很快
  216.     sql="select id from ["& datafrom &"] " & datawhere & taxis
  217.     set rs=server.createobject("adodb.recordset")
  218.     rs.open sql,conn,1,1
  219.     rs.pagesize = pages '每页显示记录数
  220.     if page < 1 then page = 1
  221.     if page > pagec then page = pagec
  222.     if pagec > 0 then rs.absolutepage = page  
  223.     for i=1 to rs.pagesize
  224.   if rs.eof then exit for  
  225.   if(i=1)then
  226.     sqlid=rs("id")
  227.   else
  228.     sqlid=sqlid &","&rs("id")
  229.   end if
  230.   rs.movenext
  231.     next
  232.   '获取本页需要用到的id结束============================================
  233.   end if
  234. '-----------------------------------------------------------
  235. '-----------------------------------------------------------
  236.   if(idcount>0 and sqlid<>"") then'如果记录总数=0,则不处理
  237.     '用in刷选本页所语言的数据,仅读取本页所需的数据,所以速度快
  238.     sql="select * from ["& datafrom &"] where id in("& sqlid &") "&taxis
  239.     set rs=server.createobject("adodb.recordset")
  240.     rs.open sql,conn,0,1
  241.     while(not rs.eof)'填充数据到表格
  242.   Response.Write "<tr bgcolor='#eafefe' onMouseOver = ""this.style.backgroundColor = '#FFFFFF'"" onMouseOut = ""this.style.backgroundColor = ''"" style='cursor:hand'>" & vbCrLf
  243.       Response.Write "<td nowrap>"&rs("ID")&"</td>" & vbCrLf
  244.       Response.Write "<td nowrap>"&rs("GroupID")&"</td>" & vbCrLf
  245.       Response.Write "<td nowrap>"&rs("GroupNameCh")&"</td>" & vbCrLf
  246.       Response.Write "<td nowrap><font color='green'>"&rs("GroupLevel")&"</font></td>" & vbCrLf
  247.   if len(rs("Explain"))>24 then
  248.         Response.Write "<td nowrap title='说明:&#13;"&rs("Explain")&"'>"&left(rs("Explain"),22)&"...</td>" & vbCrLf
  249.       else
  250.         Response.Write "<td nowrap title='说明:&#13;"&rs("Explain")&"'>"&rs("Explain")&"</td>" & vbCrLf
  251.       end if 
  252.       Response.Write "<td nowrap>"&rs("AddTime")&"</td>" & vbCrLf
  253.       Response.Write "<td width='40' nowrap><a href='MemGroup.asp?Result=Modify&ID="&rs("ID")&"' onClick='changeAdminFlag(""修改会员组别"")'><font color='#330099'>修改</font></a></td>" & vbCrLf
  254.       if rs("ID")=1 or rs("ID")=2 then
  255.     Response.Write "<td width='22' nowrap></td>" & vbCrLf
  256.       else
  257.       Response.Write "<td width='22' nowrap><input name='selectID' type='checkbox' value='"&rs("GroupID")&"' style='HEIGHT: 13px;WIDTH: 13px;'></td>" & vbCrLf
  258.       end if
  259.       Response.Write "</tr>" & vbCrLf
  260.   rs.movenext
  261.     wend
  262.     Response.Write "<tr>" & vbCrLf
  263.     Response.Write "<td colspan='6' nowrap  bgcolor='#eafefe'>&nbsp;</td>" & vbCrLf
  264.     Response.Write "<td nowrap colspan='2'  bgcolor='#eafefe'><input name='submitDelSelect' type='button' class='button'  id='submitDelSelect' value='删除所选'  onClick='ConfirmDel(""您真的要删除这些会员组别吗?"");'></td>" & vbCrLf
  265.     Response.Write "</tr>" & vbCrLf
  266.   else
  267.     response.write ("<tr><td height='50' align='center' colspan='8' nowrap  bgcolor='#eafefe'>暂无会员组别</td></tr>")
  268.   end if
  269. '-----------------------------------------------------------
  270. '-----------------------------------------------------------
  271.   Response.Write "<tr>" & vbCrLf
  272.   Response.Write "<td colspan='8' nowrap  bgcolor='#bbe5e5'>" & vbCrLf
  273.   Response.Write "<table width='100%' border='0' align='center' cellpadding='0' cellspacing='0'>" & vbCrLf
  274.   Response.Write "<tr>" & vbCrLf
  275.   Response.Write "<td>共计:<font color='#ff6600'>"&idcount&"</font>条记录&nbsp;页次:<font color='#ff6600'>"&page&"</font></strong>/"&pagec&"&nbsp;每页:<font color='#ff6600'>"&pages&"</font>条</td>" & vbCrLf
  276.   Response.Write "<td align='right'>" & vbCrLf
  277.   '设置分页页码开始===============================
  278.   pagenmin=page-pagenc '计算页码开始值
  279.   pagenmax=page+pagenc '计算页码结束值
  280.   if(pagenmin<1) then pagenmin=1 '如果页码开始值小于1则=1
  281.   if(page>1) then response.write ("<a href='"& myself &"Page=1'><font style='FONT-SIZE: 14px; FONT-FAMILY: Webdings'>9</font></a>&nbsp;") '如果页码大于1则显示(第一页)
  282.   if(pagenmin>1) then response.write ("<a href='"& myself &"Page="& page-(pagenc*2+1) &"'><font style='FONT-SIZE: 14px; FONT-FAMILY: Webdings'>7</font></a>&nbsp;") '如果页码开始值大于1则显示(更前)
  283.   if(pagenmax>pagec) then pagenmax=pagec '如果页码结束值大于总页数,则=总页数
  284.   for i = pagenmin to pagenmax'循环输出页码
  285. if(i=page) then
  286.   response.write ("&nbsp;<font color='#ff6600'>"& i &"</font>&nbsp;")
  287. else
  288.   response.write ("[<a href="& myself &"Page="& i &">"& i &"</a>]")
  289. end if
  290.   next
  291.   if(pagenmax<pagec) then response.write ("&nbsp;<a href='"& myself &"Page="& page+(pagenc*2+1) &"'><font style='FONT-SIZE: 14px; FONT-FAMILY: Webdings'>8</font></a>&nbsp;") '如果页码结束值小于总页数则显示(更后)
  292.   if(page<pagec) then response.write ("<a href='"& myself &"Page="& pagec &"'><font style='FONT-SIZE: 14px; FONT-FAMILY: Webdings'>:</font></a>&nbsp;") '如果页码小于总页数则显示(最后页)
  293.   '设置分页页码结束===============================
  294.   Response.Write "跳到:第&nbsp;<input name='SkipPage' onKeyDown='if(event.keyCode==13)event.returnValue=false' onchange=""if(/D/.test(this.value)){alert('只能在跳转目标页框内输入整数!');this.value='"&Page&"';}"" style='HEIGHT: 18px;WIDTH: 40px;'  type='text' class='textfield' value='"&Page&"'>&nbsp;页" & vbCrLf
  295.   Response.Write "<input style='HEIGHT: 18px;WIDTH: 20px;' name='submitSkip' type='button' class='button' onClick='GoPage("""&Myself&""")' value='GO'>" & vbCrLf
  296.   Response.Write "</td>" & vbCrLf
  297.   Response.Write "</tr>" & vbCrLf
  298.   Response.Write "</table>" & vbCrLf
  299.   rs.close
  300.   set rs=nothing
  301.   Response.Write "</td>" & vbCrLf  
  302.   Response.Write "</tr>" & vbCrLf
  303. '-----------------------------------------------------------
  304. '-----------------------------------------------------------
  305. end function 
  306. %>