<!--#include file=../conn.asp-->
<!-- #include file="inc/const.asp" -->
<%Head()
	dim admin_flag
	admin_flag=",9,"
	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()
	End If
		Main(1)
		Select Case Request("action")
		Case "search"''读取数据列表
		call search()
		Case "Toset"''执行操作
		call Toset()
		Case "lockuser"''锁定用户
		call lockuser()
		Case Else
		call sIndex()''搜索表单
		End Select
		Main(0)
		Footer()

sub main(Str)
if Str=1 then%>
<table width="95%" border="0" cellspacing="1" cellpadding="3"  align=center class="tableBorder">
  <tr> 
    <th height="23" colspan="8" class="tableHeaderText">举报管理中心</th>
  </tr>
  <tr> 
    <td width="18%" height="25" align="center" class="forumrow">注意事项</td>
    <td width="77%" height="25" class="forumrow" colspan="7">
	<li>删除举报此操作是不可逆的；</li>
	<li>可对日记、文章、个人资料等举报管理；</li>
	<li>举报属实可以锁定用户等操作</li>
	</td>
  </tr>
  <tr> 
    <td height="29" align="center" class="forumRowHighlight">快捷方式</td>
	<td width="77%" height="29" class="forumRowHighlight" colspan="7"><a href="postcom.asp">管理首页</a> 
      | <a href="?action=search&t=1">所有举报</a> 
      | <a href="?action=search&t=2">最新100</a> | <a href="?action=search&t=3">举报确认</a> </td>
  </tr>
  <%
	Else
%>
</table>
<p></p>
<%end if
end sub
'搜索项
Sub SIndex()%>
<form action="?action=search" method=post>
<input type=hidden name="t" value="4"> 
<tr>
<th align=left colspan=8 height=23>高级查询</th>
</tr>
<tr>
<td width=20% class=forumrow>注意事项</td>
<td width=80% class=forumrow colspan=7>在记录很多的情况下搜索条件越多查询越慢，请尽量减少查询条件</td>
</tr>
<tr>
<td width=20% class=forumrow>会员姓名</td>
<td width=80% class=forumrow colspan=7><input name="username" type="text" size="20">&nbsp;<input type=checkbox name="like" value="1" checked>
      完整匹配</td>
</tr>
<tr>
<td width=20% class=forumrow>举报标题</td>
<td width=80% class=forumrow colspan=7><input name="Title" type="text" size="30"></td>
</tr>
<tr>
<td width=20% class=forumrow>举报地址</td>
<td width=80% class=forumrow colspan=7><input name="Pageurl" type="text" size="30"></td>
</tr>
<tr>
<td width=100% class=forumrow align=center colspan=8><input name="submit" type=submit value="   搜  索   "></td>
</tr>
</form>
<%
End Sub

sub search()''列出所有数据
strFileName="postcom.asp?action="&Request("action") & "&t="&request("t")&"&title="&request("title")&"&like="&request("like")&"&Pageurl="&request("Pageurl")&""
call tumppages()
dim sql
sql = " id,Username,Pageurl,Title,Comuser,Flag,Typeid,Addtime "%>
<tr>
<th colspan=8 align=left height=23>搜索结果</th>
</tr>
<FORM METHOD=POST ACTION="?action=Toset">
<tr align=center height=23>
<td class=forumRowHighlight width="18%"><B>用户名</B></td>
<td class=forumRowHighlight width="28%"><B>举报地址</B></td>
<td class=forumRowHighlight width="12%"><B>举报人</B></td>
<td class=forumRowHighlight width="15%"><B>时间</B></td>
<td class=forumRowHighlight width="6%"><B>状态</B></td>
<td class=forumRowHighlight width="9%"><B>类别</B></td>
<td class=forumRowHighlight><B>操作</B></td>
</tr>
<%dim sqlstr
set rs=server.createobject("adodb.recordset")
Select Case Request("t")
	Case 1
		Sql = "SELECT " & sql & " from Ms_Complain ORDER BY ID DESC"
	Case 2
		Sql = "SELECT top 100 " & sql & " from Ms_Complain ORDER BY ID DESC"
	case 3
		Sql = "SELECT " & sql & " from Ms_Complain where Flag=1 ORDER BY ID DESC"
	case 4
	sqlstr=""''搜索开始
		if request("username")<>"" then
			if request("like")=1 then
			sqlstr=" username='"&request("username")&"'"
			else
			sqlstr=" username like '%"&request("username")&"%'"
			end if
		end if
		if request("Title")<>"" then
			if sqlstr<>"" then
			sqlstr=sqlstr & " and Title like '%"&request("Title")&"%'"
			else
			sqlstr=" Title like '%"&request("Title")&"%'"
			end if
		end if
		if request("Pageurl")<>"" then
			if sqlstr<>"" then
			sqlstr=sqlstr & " and Pageurl like '%"&request("Pageurl")&"%'"
			else
			sqlstr=" Pageurl like '%"&request("Pageurl")&"%'"
			end if
		end if
		if sqlstr<>"" then
		Sql = "SELECT " & sql & " FROM [Ms_Complain] WHERE " & Sqlstr & " ORDER BY ID DESC"
		else
		Response.Write "<tr><td colspan=7 class=forumrow>搜索条件不能都为空。</td></tr>"
		Response.End
		end if
	case else
		Response.Write "<tr><td colspan=7 class=forumrow>错误的参数。</td></tr>"
		Response.End
	End Select
	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)%>
<tr align=center height=23>
<td class=forumrow><a href="admin_user.asp?action=modify&username=<%=rs(1)%>"><%=rs(1)%></a></td>
<td class=forumrow align="left"><a href=../<%=rs(2)%> target=_blank title=<%=rs(3)%>><%=rs(2)%></a></td>
<td class=forumrow><a href=?action=lockuser&id=<%=rs(0)%> title="点击锁定该用户"><%=rs(4)%></a></td>
<td class=forumrow><%=rs(7)%></td>
<td class=forumrow>
<%if rs(5)=0 then
response.Write("<font color=red>未确认</font>")
else
response.Write("<font color=green>已确认</font>")
end if%></td>
<td class=forumrow><%if rs(6)=1 then
response.Write("用户举报")
elseif rs(6)=2 then
response.Write("日记举报")
elseif rs(6)=3 then
response.Write("文章举报")
elseif rs(6)=4 then
response.Write("征婚举报")
elseif rs(6)=5 then
response.Write("约会举报")
elseif rs(6)=6 then
response.Write("聚会举报")
elseif rs(6)=7 then
response.Write("相册举报")
else
response.Write("意见建议")
end if%></td>
<td 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=7 class=forumrow>暂时数据。</td></tr>")
  end if
  if totalrec>0 then%>
<tr align="center"> 
      <td height="24" colspan="7" class=forumrow><%
		  	call showpage(strFileName)
		  %></td>
    </tr>
<%end if%>
<tr align="center"> 
      <td height="24" colspan="7" 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="radio" name="paction" value="3">用户操作
	  <select name="chkuser">
	  <option value=""></option>
	  <option value=1>锁定用户</option>
	  <option value=2>屏蔽用户</option>
	  <option value=3>撤消操作</option>
	  </select>
	  全部选定<input type=checkbox value="on" name="chkall" onclick="CheckAll(this.form)"></td>
    </tr>
	<tr align="center"> 
      <td height="24" colspan="7" class=forumRowHighlight><input type=submit name=submit value="执行操作"  onclick="{if(confirm('确定执行操作吗?')){return true;}return false;}"></td>
    </tr>
</form>
<%end sub

sub Toset()''执行操作
dim delid,fixid,Maxnum
response.write "<tr><th colspan=7 height=23 align=left>执行结果</th></tr>"
	if request("paction")="" then
		response.write "<tr><td colspan=7 class=forumrow>请指定相关参数。</td></tr>"
		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''删除操作
				Conn.Execute("delete from Ms_Complain where id in ("&delid&")")
				response.write "<tr><td colspan=7 class=forumrow>删除记录成功。</td></tr>"
		elseif request("paction")=2 then''审核操作
			if Cint(request("chkset"))=1 then
			Conn.Execute("update Ms_Complain set Flag=1 where id in ("&delid&")")''审核记录
		response.write "<tr><td colspan=7 class=forumrow>选定确认成功。</td></tr>"
			elseif Cint(request("chkset"))=2 then
			Conn.Execute("update Ms_Complain set Flag=1 where Checked=0")''审核记录
		response.write "<tr><td colspan=7 class=forumrow>全部确认聚会成功。</td></tr>"
			elseif Cint(request("chkset"))=3 then
			Conn.Execute("update Ms_Complain set Flag=0 where id in ("&delid&")")''撤消记录
		response.write "<tr><td colspan=7 class=forumrow>选定撤消成功。</td></tr>"
			elseif Cint(request("chkset"))=4 then
			Conn.Execute("update Ms_Complain set Flag=0 where Checked=1")''撤消记录
		response.write "<tr><td colspan=7 class=forumrow>全部撤消成功。</td></tr>"
			end if
		elseif request("paction")=3 then''审核操作
		set rs=Conn.Execute("select Comuser from Ms_Complain where id in ("&delid&")")
			if not (rs.eof and rs.bof) then
				if Cint(request("chkuser"))=1 then
				Conn.Execute("update Ms_user set LockUser=1 where Username='"&rs(0)&"'")
				elseif Cint(request("chkuser"))=2 then
				Conn.Execute("update Ms_user set LockUser=2 where Username='"&rs(0)&"'")
				else
				Conn.Execute("update Ms_user set LockUser=0 where Username='"&rs(0)&"'")
				end if
			end if
			rs.close
		response.write "<tr><td colspan=7 class=forumrow>用户操作成功。</td></tr>"
		else
		response.write "<tr><td colspan=7 class=forumrow>错误的参数。</td></tr>"
		end if
end if
end sub

sub lockuser()''锁定用户
dim id
id=Request("id")
response.write "<tr><th colspan=7 height=23 align=left>执行锁定结果</th></tr>"
	if request("id")="" then
		response.write "<tr><td colspan=7 class=forumrow>请指定相关参数。</td></tr>"
		founderr=true
	end if
if not founderr then
		set rs=Conn.Execute("select Comuser from Ms_Complain where id ="&id&"")
			if not (rs.eof and rs.bof) then
				Conn.Execute("update Ms_user set LockUser=1 where Username='"&rs(0)&"'")
			end if
			rs.close
		response.write "<tr><td colspan=8 class=forumrow>锁定操作成功。</td></tr>"
else
		response.write "<tr><td colspan=8 class=forumrow>错误的参数。</td></tr>"
end if
end sub%>