<!--#include file=../conn.asp-->
<!-- #include file="inc/const.asp" -->
<%Head()
	dim admin_flag,action
	action=request("action")
	admin_flag=",20,"
	if not master or instr(","&session("flag")&",",admin_flag)=0 then
		Errmsg=ErrMsg + "<BR><li>本页面为管理员专用，请<a href=../"&LoginUrl&" target=_top>登录</a>后进入。<br><li>您没有管理本页面的权限。"
		Call Ms_error()
	Else
		if action="list" or action="" then
		call list()
		elseif action="Toset" then
		Call Toset()
		end if
		Footer()
	End If

sub list()
dim sql,t
call tumppages()'翻页处理
strFileName="marry.asp?action="&request("action")&"&t="&request("t")&""
sql=" mid,username,Marinfo,addtime "
t=request("t")
if t="" or action="" then
t=1
end if
%>
<table width="95%" border="0" cellspacing="1" cellpadding="3"  align=center class="tableBorder">
  <tr> 
    <th height="23" colspan="3" class="tableHeaderText">征婚管理中心</th>
  </tr>
  <tr> 
    <td height="25" colspan="3" class="forumrow"><a href=?action=list&t=1>所有征婚</a> | <a href=?action=list&t=2>未审核</a> </td>
  </tr>
  <tr>
<th colspan=3 align=center height=23>列表情况</th>
</tr>
  <FORM METHOD=POST ACTION="?action=Toset">
  <tr> 
    <td width="20%" height="25" align="center" class="forumRowHighlight">用户名称</td>
    <td width="71%" height="25" align="center" class="forumRowHighlight">征婚信息</td>
    <td width="9%" height="25" align="center" class="forumRowHighlight">操作</td>
  </tr>
  <%dim Marinfo
	set rs=server.createobject("adodb.recordset")
	if request("t")=1 then
	sql="select "&sql&" from Ms_Marry order by MID desc"
	elseif request("t")=2 then
	sql="select "&sql&" from Ms_Marry where checked=0 order by MID desc"
	end if
	rs.Open sql,conn,1,1
if not (rs.eof and rs.bof) then
call rspages()
do while not rs.eof and page_count<Cint(MaxPerPage)
Marinfo=split(rs(2),"|||")%>
  <tr> 
    <td height="26" align="center" class="forumrow"><a href="admin_user.asp?action=modify&username=<%=rs(1)%>"><%=rs(1)%></a></td>
    <td height="26" class="forumrow">要求：年 龄 <font color="#CC6699"><%=Marinfo(0)%>-<%=Marinfo(1)%></font> 岁 | 所在地区 <font color="#CC6699"><%=Marinfo(6)%>&nbsp;<%=Marinfo(7)%></font> | 身 高 <font color="#CC6699"><%=Marinfo(2)%></font> | 学 历 <font color="#CC6699"><%=Marinfo(5)%></font> | 收入水平 <font color="#CC6699"><%=Marinfo(4)%></font> 元  发布时间： <%=rs(3)%></td>
    <td height="26" align="center" class="forumrow">
<input type="checkbox" name="id" value="<%=rs(0)%>"></td>
  </tr>
  <%page_count=page_count+1
  rs.movenext
  loop
  else
  response.Write("<tr><td colspan=3 class=forumrow>暂时数据。</td></tr>")
  end if
  if totalrec>0 then%>
<tr align="center"> 
      <td height="24" colspan="3" class=forumrow><%
		  	call showpage(strFileName)
		  %></td>
    </tr>
<%end if%>
<tr align="center"> 
      <td height="24" colspan="3" class=forumrow align="right"><input type="radio" name="paction" value="1">删除记录
	  <input type="radio" name="paction" value="2">审核操作
	  <select name="chkset">
	  <option value=""></option>
	  <option value=1>选定审核</option>
	  <option value=2>全部审核</option>
	  <option value=3>选定撤消</option>
	  <option value=4>全部撤消</option>　
	  </select>
	  
	  全部选定<input type=checkbox value="on" name="chkall" onclick="CheckAll(this.form)"></td>
    </tr>
	<tr align="center"> 
      <td height="24" colspan="8" class=forumRowHighlight><input type=submit name=submit value="执行操作"  onclick="{if(confirm('确定执行操作吗?')){return true;}return false;}"></td>
    </tr>
</form>
</table>
<%rs.close
end sub

sub Toset()
dim delid,fixid,Maxnum
	if request("paction")="" then
		Ms_suc("请指定相关参数。")
		founderr=true
	end if
	delid=replace(request.form("id"),"'","")
	delid=replace(delid,";","")
	delid=replace(delid,"--","")
	delid=replace(delid,")","")
	fixid=replace(delid,",","")
	fixid=Trim(replace(fixid," ",""))
if not founderr then
		if request("paction")=1 then''删除操作
			Maxnum=ubound(split(delid,","))
			Conn.Execute("delete from Ms_marry where Mid in ("&delid&")")
			Conn.Execute("Update Ms_setup set Marrynum=Marrynum-"&(Maxnum+1)&" where Cid =1")''更新统计表
			Ms_suc("删除征婚成功。")
		elseif request("paction")=2 then''审核操作
			if Cint(request("chkset"))=1 then
			Conn.Execute("update Ms_marry set Checked=1 where Mid in ("&delid&")")''审核记录
			Ms_suc("选定审核成功。")
			elseif Cint(request("chkset"))=2 then
			Conn.Execute("update Ms_marry set Checked=1 where Checked=0")''审核记录
			Ms_suc("全部审核成功。")
			elseif Cint(request("chkset"))=3 then
			Conn.Execute("update Ms_marry set Checked=0 where Mid in ("&delid&")")''撤消记录
		Ms_suc("选定撤消成功。")
			elseif Cint(request("chkset"))=4 then
			Conn.Execute("update Ms_marry set Checked=0 where Checked=1")''撤消记录
		Ms_suc("全部撤消成功。")
			end if
		else
		Ms_suc("错误的参数。")
		end if
end if
end sub%>