<!--#include file=../conn.asp-->
<!-- #include file="inc/const.asp" -->
<%Head()
	dim admin_flag
	admin_flag=",7,"
	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)
		if Request("action")="list" then
		call search()
		elseif Request("action")="Toset" then
		call Toset()
		end if
		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="6" class="tableHeaderText">祈愿管理中心</th>
</tr>
<tr>
<td height="25" colspan="1" class="forumrow">说明事项：
</td>
<td height="25" colspan="5" class="forumrow">祈愿记录删除将不可恢复；<br>
祈愿记录查看等等
</td>
</tr>
<tr>
<td height="25" colspan="1" class="forumrow">快捷方式
</td>
<td height="25" colspan="5" class="forumrow"><a href=?action=list&t=1>所有祈愿</a> | <a href=?action=list&t=2>最新100</a> | <a href=?action=list&t=3>人气100</a>
</td>
</tr>
<%
	Else
%>
</table>
<p></p>
<%end if
end sub

sub search()''搜索列表
strFileName="wish.asp?action="&Request("action") & "&t="&request("t")&""
call tumppages()
dim sql
sql= " id,Username,Typeid,hits,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="20%"><B>用户名</B></td>
<td class=forumRowHighlight width="15%"><B>记录ID</B></td>
<td class=forumRowHighlight width="15%"><B>所属类别</B></td>
<td class=forumRowHighlight width="15%"><B>人气</B></td>
<td class=forumRowHighlight width="20%"><B>发布时间</B></td>
<td class=forumRowHighlight><B>操作</B></td>
</tr>
<%set rs=server.createobject("adodb.recordset")
Select Case Request("t")
	Case 1
		Sql = "SELECT " & sql & " from Ms_wish ORDER BY ID DESC"
	Case 2
		Sql = "SELECT top 100 " & sql & " from Ms_wish ORDER BY ID DESC"
	case 3
		sql="select top 100 " & sql & " from Ms_wish  order by hits desc"
	case else
		Response.Write "<tr><td colspan=8 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>
<td class=forumrow align="center"><a href="admin_user.asp?action=modify&username=<%=rs(1)%>"><%=rs(1)%></a></td>
<td class=forumrow align="center">
<a href=../wish.asp?action=view&id=<%=rs(0)%> target=_blank><%=rs(0)%></a></td>
<td class=forumrow align=center>
<%Select Case rs(2)
Case 1
response.Write("爱情")
Case 2
response.Write("学业")
Case 3
response.Write("健康")
Case 4
response.Write("家庭")
Case 5
response.Write("事业")
Case 6
response.Write("未来")
Case 7
response.Write("财富")
Case 8
response.Write("生活")
Case else
response.Write("情人节")
end Select%></td>
<td class=forumrow align=center><%=rs(3)%></td>
<td class=forumrow align=center><%=rs(4)%>
</td>
<td class=forumrow align=center><input type="checkbox" name="id" value="<%=rs(0)%>"></td>
</tr>
<%page_count=page_count+1
  rs.movenext
  loop
  end if
  
 if totalrec>0 then %>
    <tr align="center"> 
      <td height="24" colspan="8" class=forumrow> <%
		  	call showpage(strFileName)
		  %></td>
    </tr>
	<%end if%>
<tr align="center"> 
      <td height="24" colspan="8" class=forumrow><input type="radio" name="paction" value=1>删除记录
	  <input type="radio" name="paction" value=2>清空类别
	  <select name="Pset">
       <OPTION value=0 selected>请选择</OPTION>
        <OPTION value=1>爱情</OPTION>
        <OPTION value=2>学业</OPTION>
        <OPTION value=3>健康</OPTION>
        <OPTION value=4>家庭</OPTION>
        <OPTION value=5>事业</OPTION>
        <OPTION value=6>未来</OPTION>
        <OPTION value=7>财富</OPTION>
        <OPTION value=8>生活</OPTION>
        <OPTION value=9>情人节</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>
<%end sub

sub ToSet()''批量操作
dim delid,fixid
response.write "<tr><th colspan=8 height=23 align=left>执行结果</th></tr>"
	if request("paction")="" then
		response.write "<tr><td colspan=8 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_wish where id in ("&delid&")")
				response.write "<tr><td colspan=8 class=forumrow>删除记录成功。</td></tr>"
		elseif request("paction")=2 then''清空类操作
			if request("Pset")<>0 then
			Conn.Execute("delete from Ms_wish where Typeid="&request("Pset")&"")
				response.write "<tr><td colspan=8 class=forumrow>清空类别成功。</td></tr>"
			end if
		else
			response.write "<tr><td colspan=8 class=forumrow>错误的参数。</td></tr>"
		end if
		end if
end sub
%>