memgroup.asp

来自「生成html的ASP企业站点,可以进行二次开发的」· ASP 代码 · 共 282 行

ASP
282
字号
<%@ LANGUAGE = VBScript %>
<HTML xmlns="http://www.w3.org/1999/xhtml">
<HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=gb2312" />
<TITLE>会员组别编辑</TITLE>
<link rel="stylesheet" href="Images/Admin.css">
<script language="javascript" src="../Script/Admin.js"></script>
</HEAD>
<!--#include file="../Include/Const.asp" -->
<!--#include file="../Include/ConnSiteData.asp" -->
<!--#include file="CheckAdmin.asp"-->
<BODY>
<%
Dim quanxian
quanxian=trim(Request.ServerVariables(name))

if Instr(session("AdminPurview"),"|32,")=0 then
  response.write ("<br><br><div align=""center""><font style=""color:red; font-size:9pt; "")>您没有管理该模块的权限!</font></div>")
  response.end
end if
%>
<br>
<table class="tableborder" width="95%" border="0" align="center" cellpadding="3" cellspacing="1">
  <tr>
    <th>网站会员管理:会员组别设置,添加,修改会员信息</th>
  </tr>
  <tr>
    <td height="24" align="center" nowrap="nowrap"  class="forumrow"><a href="MemGroup.asp?Result=Add" onclick='changeAdminFlag(&quot;添加会员组别&quot;)'>添加会员组别</a><font color="#0000FF">&nbsp;|&nbsp;</font><a href="MemList.asp" onclick='changeAdminFlag(&quot;查看所有会员&quot;)'>查看所有会员</a></td>
  </tr>
</table>
<%
dim Result
Result=request.QueryString("Result")
dim ID,GroupID,GroupNameCH,GroupLevel,Explain,AddTime,RanNum
ID=request.QueryString("ID")
randomize timer
RanNum=Int((8999)*Rnd +1009)
if ID="" then GroupID=year(now)&month(now)&day(now)&hour(now)&minute(now)&second(now)&RanNum
if Result<>"" then
  call MemGroupEdit()
end if
%>
<br>
<table class="tableborder" width="95%" border="0" align="center" cellpadding="3" cellspacing="1">
<form action="DelContent.asp?Result=MemGroup" method="post" name="formDel">
  <tr>
    <td class="title"  width="20">ID</th>
	<td class="title"  >组别号</th>
	<td class="title"  width="80">组别名称</th>
	<td class="title" width="60">权限值</th>
	<td class="title">说明</th>
	<td class="title" width="120">创建时间</th>
	<td class="title" width="80">操作</th>
	<td width="80" align="center" class="title"><input onClick="CheckAll(this.form)" name="buttonAllSelect" type="button" id="submitAllSearch" value="全选"> <input onClick="CheckOthers(this.form)" name="buttonOtherSelect" type="button" id="submitOtherSelect" value="反选"></th>  </tr>
  <% MemGroupList() %>
  </form>
</table>
</BODY>
</HTML>
<%
sub MemGroupEdit()
  dim Action,rs,sql
  Action=request.QueryString("Action")
  if Action="SaveEdit" then
    set rs = server.createobject("adodb.recordset")
    if Result="Add" then
	  sql="select * from LiangJingCMS_MemGroup"
      rs.open sql,conn,1,3
      rs.addnew
      if len(trim(Request.Form("GroupNameCH")))<3 or len(trim(Request.Form("GroupNameCH")))>16  then
        response.write "<script language='javascript'>alert('请填写中文会员组别名称(6-16个字符或3-8个汉字)!');history.back(-1);</script>"
        response.end
      end if
      if len(trim(Request.Form("GroupNameEn")))<1 then
        response.write "<script language=javascript> alert('请填写英文会员组别名称(6-16个字符)!');history.back(-1);</script>"
        response.end
      end if
	  rs("GroupID")=Request.Form("GroupID")
	  rs("GroupNameCH")=trim(Request.Form("GroupNameCH"))
	  rs("GroupNameEn")=trim(Request.Form("GroupNameEn"))
	  rs("GroupLevel")=trim(Request.Form("GroupLevel"))
	  rs("Explain")=trim(Request.Form("Explain"))
	  rs("AddTime")=now()
	end if
	if Result="Modify" then
      sql="select * from LiangJingCMS_MemGroup where ID="&ID
      rs.open sql,conn,1,3
      if len(trim(Request.Form("GroupNameCH")))<3 or len(trim(Request.Form("GroupNameCH")))>16  then
        response.write "<script language='javascript'>alert('请填写中文会员组别名称(6-16个字符或3-8个汉字)!');history.back(-1);</script>"
        response.end
      end if
      if len(trim(Request.Form("GroupNameEn")))<1 then
        response.write "<script language=javascript> alert('请填写英文会员组别名称(6-16个字符)!');history.back(-1);</script>"
        response.end
      end if
	  rs("GroupNameCh")=trim(Request.Form("GroupNameCh"))
	  rs("GroupNameEn")=trim(Request.Form("GroupNameEn"))
	  rs("GroupLevel")=trim(Request.Form("GroupLevel"))
	  rs("Explain")=trim(Request.Form("Explain"))
      conn.execute("Update LiangJingCMS_Members set GroupName='"&trim(Request.Form("GroupNameCH"))&"' where GroupID='"&trim(Request.Form("GroupID"))&"'")
	end if
	rs.update
	rs.close
    set rs=nothing
    response.write "<script language='javascript'>alert('设置成功!');location.replace('MemGroup.asp');</script>"
  else
	if Result="Modify" then
      set rs = server.createobject("adodb.recordset")
      sql="select * from LiangJingCMS_MemGroup where ID="& ID
      rs.open sql,conn,1,1
	  if rs.RecordCount=0 then
        response.write "<script language='javascript'>alert('无此记录!');history.back(-1)</script>"
        response.end
	  end if
	  ID=rs("ID")
      GroupID=rs("GroupID")
	  GroupNameCh=rs("GroupNameCh")
	  GroupNameEn=rs("GroupNameEn")
	  GroupLevel=rs("GroupLevel")
	  Explain=rs("Explain")
	  rs.close
      set rs=nothing
	end if
  end if
%>
<br>
<table class="tableborder" width="95%" border="0" align="center" cellpadding="3" cellspacing="1">
  <form name="editMemGroup" method="post" action="MemGroup.asp?Action=SaveEdit&Result=<%=Result%>&ID=<%=ID%>">
    <tr>
      <th height="22" colspan="2">【修改会员组别】</th>
    </tr>
    <tr>
      <td width="20%" align="right" class="forumRow">ID:</td>
      <td width="80%" class="forumRowHighlight"><input name="ID" type="text" id="ID" style="width: 80" value="<%if ID="" then response.write ("自动") else response.write (ID) end if%>" maxlength="6" readonly></td>
    </tr>
    <tr>
      <td align="right" class="forumRow">组别号:</td>
      <td class="forumRowHighlight"><input name="GroupID" type="text" id="GroupID" style="width: 180" value="<%=GroupID%>" maxlength="18" readonly> <font color="red">*</font></td>
    </tr>
      <tr>
        <td align="right" class="forumRow">中文组别名称:</td>
        <td  class="forumRowHighlight"><input name="GroupNameCh" type="text" class="textfield" id="GroupNameCh" style="WIDTH: 100;" value="<%=GroupNameCh%>">&nbsp;*</td>
      </tr>
      <tr>
        <td align="right" class="forumRow">英文组别名称:</td>
        <td  class="forumRowHighlight"><input name="GroupNameEn" type="text" class="textfield" id="GroupNameEn" style="WIDTH: 100;" value="<%=GroupNameEn%>">&nbsp;*</td>
      </tr>
	<tr>
      <td align="right" class="forumRow">权限值:</td>
      <td class="forumRowHighlight"><input name="GroupLevel" type="text" id="GroupLevel" style="width: 80" value="<%=GroupLevel%>" onChange="if(/\D/.test(this.value)){alert('请在权限值中输入整数!');}"> <font color="red">*</font></td>
    </tr>
	<tr>
      <td align="right" class="forumRow">备注:</td>
      <td class="forumRowHighlight"><textarea name="Explain" rows="8" id="Explain" style="width: 500"><%=Explain%></textarea></td>
    </tr>
    <tr>
      <td align="right" class="forumRow"></td>
      <td class="forumRowHighlight"><input name="submitSaveEdit" type="submit" id="submitSaveEdit" value="保存"></td>
    </tr>
  </form>
</table>
<%
End Sub

function MemGroupList()
  dim idCount
  dim pages
      pages=20
  dim pagec
  dim page
      page=clng(request("Page"))
  dim pagenc
      pagenc=2
  dim pagenmax
  dim pagenmin
  dim datafrom
      datafrom="LiangJingCMS_MemGroup"
  dim datawhere
      datawhere=""
  dim sqlid
  dim Myself,PATH_INFO,QUERY_STRING
      PATH_INFO = request.servervariables("PATH_INFO")
	  QUERY_STRING = request.ServerVariables("QUERY_STRING")'
      if QUERY_STRING = "" or Instr(PATH_INFO & "?" & QUERY_STRING,"Page=")=0 then
	    Myself = PATH_INFO & "?"
	  else
	    Myself = Left(PATH_INFO & "?" & QUERY_STRING,Instr(PATH_INFO & "?" & QUERY_STRING,"Page=")-1)
	  end if
  dim taxis
      taxis="order by id desc"
  dim i
  dim rs,sql
  sql="select count(ID) as idCount from ["& datafrom &"]" & datawhere
  set rs=server.createobject("adodb.recordset")
  rs.open sql,conn,0,1
  idCount=rs("idCount")
  if(idcount>0) then
    if(idcount mod pages=0)then
	  pagec=int(idcount/pages)
   	else
      pagec=int(idcount/pages)+1
    end if
    sql="select id from ["& datafrom &"] " & datawhere & taxis
    set rs=server.createobject("adodb.recordset")
    rs.open sql,conn,1,1
    rs.pagesize = pages
    if page < 1 then page = 1
    if page > pagec then page = pagec
    if pagec > 0 then rs.absolutepage = page  
    for i=1 to rs.pagesize
	  if rs.eof then exit for  
	  if(i=1)then
	    sqlid=rs("id")
	  else
	    sqlid=sqlid &","&rs("id")
	  end if
	  rs.movenext
    next
  end if
  if(idcount>0 and sqlid<>"") then
    sql="select * from ["& datafrom &"] where id in("& sqlid &") "&taxis
    set rs=server.createobject("adodb.recordset")
    rs.open sql,conn,0,1
    while(not rs.eof)
	  Response.Write "<tr>" & vbCrLf
      Response.Write "<td nowrap class=""forumRow"">"&rs("ID")&"</td>" & vbCrLf
      Response.Write "<td nowrap class=""forumRow"">"&rs("GroupID")&"</td>" & vbCrLf
      Response.Write "<td nowrap class=""forumRow"">"&rs("GroupNameCH")&"</td>" & vbCrLf
      Response.Write "<td nowrap class=""forumRow""><font color='blue'>"&rs("GroupLevel")&"</font></td>" & vbCrLf
	  if len(rs("Explain"))>24 then
        Response.Write "<td nowrap title='"&rs("Explain")&"' class=""forumRow"">"&left(rs("Explain"),22)&"…</td>" & vbCrLf
      else
        Response.Write "<td nowrap title='"&rs("Explain")&"' class=""forumRow"">"&rs("Explain")&"</td>" & vbCrLf
      end if 
      Response.Write "<td nowrap class=""forumRow"">"&rs("AddTime")&"</td>" & vbCrLf
      Response.Write "<td align=""center""nowrap class=""forumRow""><a href='MemGroup.asp?Result=Modify&ID="&rs("ID")&"'>修改</a></td>" & vbCrLf
	  if rs("ID")=1 or rs("ID")=2 Then
	  Response.Write "<td nowrap align='center' class=""forumRow""><font color=""red"">×</font></td>" & vbCrLf
	  Else
 	  Response.Write "<td nowrap align='center' class=""forumRow""><input name='selectID' type='checkbox' value='"&rs("GroupID")&"'></td>" & vbCrLf
	  End If
      Response.Write "</tr>" & vbCrLf
	  rs.movenext
    wend
    Response.Write "<tr>" & vbCrLf
    Response.Write "<td colspan='10' nowrap align=""right"" class=""forumRow""> <input name='submitDelSelect' type='button' id='submitDelSelect' value='删除所选' onClick='ConfirmDel(""是否确定删除?删除后不能恢复!"");'></td>" & vbCrLf
    Response.Write "</tr>" & vbCrLf
  else
    response.write "<tr><td nowrap align='center' colspan='10' class=""forumRow"">暂无会员组别</td></tr>"
  end if
  Response.Write "<tr>" & vbCrLf
  Response.Write "<td colspan='10' nowrap class=""forumRow"">" & vbCrLf
  Response.Write "<table width='100%' border='0' align='center' cellpadding='0' cellspacing='0'>" & vbCrLf
  Response.Write "<tr>" & vbCrLf
  Response.Write "<td class=""forumRow"">共计:<font color='red'>"&idcount&"</font>条记录 页次:<font color='red'>"&page&"</font></strong>/"&pagec&" 每页:<font color='red'>"&pages&"</font>条</td>" & vbCrLf
  Response.Write "<td align='right'>" & vbCrLf
  pagenmin=page-pagenc
  pagenmax=page+pagenc
  if(pagenmin<1) then pagenmin=1
  if(page>1) then response.write ("<a href='"& myself &"Page=1'><font style='font-size: 14px; font-family: Webdings'>9</font></a> ")
  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> ")
  if(pagenmax>pagec) then pagenmax=pagec
  for i = pagenmin to pagenmax
	if(i=page) then
	  response.write (" <font color='red'>"& i &"</font> ")
	else
	  response.write ("[<a href="& myself &"Page="& i &">"& i &"</a>]")
	end if
  next
  if(pagenmax<pagec) then response.write (" <a href='"& myself &"Page="& page+(pagenc*2+1) &"'><font style='font-size: 14px; font-family: Webdings'>8</font></a> ")
  if(page<pagec) then response.write ("<a href='"& myself &"Page="& pagec &"'><font style='font-size: 14px; font-family: Webdings'>:</font></a> ")
  Response.Write "第<input name='SkipPage' onKeyDown='if(event.keyCode==13)event.returnValue=false' onchange=""if(/\D/.test(this.value)){alert('请输入需要跳转到的页数并且必须为整数!');this.value='"&Page&"';}"" style='width: 28px;' type='text' value='"&Page&"'>页" & vbCrLf
  Response.Write "<input name='submitSkip' type='button' onClick='GoPage("""&Myself&""")' value='转到'>" & vbCrLf
  Response.Write "</td>" & vbCrLf
  Response.Write "</tr>" & vbCrLf
  Response.Write "</table>" & vbCrLf
  rs.close
  set rs=nothing
  Response.Write "</td>" & vbCrLf
  Response.Write "</tr>" & vbCrLf
end Function
%>

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?