<%if session("admin")="" then
response.write"你没有登录或是非法用户!<meta http-equiv=refresh content='1;url=../index.asp'>"
response.End()
end if%>
<!--#include file=conn.asp-->
<!--#include file="../config.asp"-->
<head>
<link href=../iknow.css rel=stylesheet type=text/css>
</head>
<table width="95%"  border="1" align="center" cellpadding="0" cellspacing="0" bordercolorlight="#000000" bordercolordark="#FFFFFF" height="109">
  <tr>
    <td height="23" colspan="6" align="center" bgcolor="eeeeee"><font style="font-size:14px">删除回复</font></td>
  </tr>
  <%if request("del")="删除" then
  rs.open"select * from reply where id="&cint(request("id")),conn,1,3
  '修改解决数和回复数、积分
  rs2.open"select * from person where name='"&rs("replyer")&"'",conn,1,3
  if rs("isdeal")=1 then
  rs2("helpnum")=rs2("helpnum")-1
  rs2("replynum")=rs2("replynum")-1
  rs2("jifen")=rs2("jifen")-dajiadf-dadf-dakf
  temp=rs2("jifen")-dajiadf-dadf-dakf
  rs1.open"select * from question where id="&rs("replyid")&"",conn,1,3
  rs1("jie")=0
  rs1.update
  rs1.close
  else
  rs2("replynum")=rs2("replynum")-1
  rs2("jifen")=rs2("jifen")-dadf-dakf
  temp=rs2("jifen")-dadf-dakf
  end if
  if temp<fen2 then
		  rs2("touxian")=""&ji1&" 一级"
	      elseif temp>=fen2 and temp<fen3 then
		  rs2("touxian")=""&ji2&" 二级"
		  elseif temp>=fen3 and temp<fen4 then
		  rs2("touxian")=""&ji3&" 三级"
		  elseif temp>=fen4 and temp<fen5 then
		  rs2("touxian")=""&ji4&" 四级"
		  elseif temp>=fen5 and temp<fen6 then
		  rs2("touxian")=""&ji5&" 五级"
		  elseif temp>=fen6 and temp<fen7 then
		  rs2("touxian")=""&ji6&" 六级"
		  elseif temp>=fen7 and temp<fen8 then
		  rs2("touxian")=""&ji7&" 七级"
		  elseif temp>=fen8 and temp<fen9 then
		  rs2("touxian")=""&ji8&" 八级"
		  elseif temp>=fen9 and temp<fen10 then
		  rs2("touxian")=""&ji9&" 九级"
		  elseif temp>=fen10 then
		  rs2("touxian")=""&ji10&" 十级"
		  end if
  rs2.update
  rs2.close
  
  rs3.open"select * from ping where replyid="&cint(request("id")),conn,1,3
  while not rs3.eof
  rs3.delete
  rs3.movenext
  wend
  rs3.close
  if rs("isdeal")=1 then
  rs3.open"select * from pj where jiaid="&cint(request("id")),conn,1,3
  while not rs3.eof
  rs3.delete
  rs3.movenext
  wend
  rs3.close
  end if
  rs3.open"select * from toupiao where daid="&cint(request("id")),conn,1,3
  while not rs3.eof
  rs3.delete
  rs3.movenext
  wend
  rs3.close
  rs3.open"select * from touuser where daid="&cint(request("id")),conn,1,3
  while not rs3.eof
  rs3.delete
  rs3.movenext
  wend
  rs3.close
  rs.delete
  rs.close
  response.write"<tr><td colspan=6>回复删除成功!</td></tr><meta http-equiv=refresh content='1;url=adminreply.asp'>"
  response.End()
  end if
  %>
  <tr>
    <td align="center" height="12">回复内容</td>
    <td align="center" height="12">回复人</td>
    <td align="center" height="12">回复时间</td>
    <td align="center" height="12">回复问题</td>
    <td align="center" height="12">是否解决</td>
    <td align="center" height="12">操作</td>
  </tr>
  <%rs.open"select * from reply order by id desc",conn,1,1
  if rs.eof then
  %><tr>
    <td colspan="6" align="center" height="12">暂时没有回复!</td>
  </tr>
  <%else
  maxnum=rs.recordcount
  rs.pagesize=15
  maxpage=rs.pagecount
  if request("p")="" then
  p=1
  else
  p=cint(request("p"))
  end if
  if p>maxpage then
  p=maxpage
  end if
  if p=0 then
  p=1
  end if
  if p<>1 then
  rs.move (p-1)*rs.pagesize
  end if
  for i=1 to rs.pagesize
  rs2.open"select * from question where id="&rs("replyid"),conn,1,1%>
  <form method=post action=adminreply.asp?id=<%=rs("id")%>>
    <tr>
    <td align="center" height="25"><a href=../showreply.asp?id=<%=rs("id")%> target=_blank>查看</a></td>
    <td align="center" height="25"><%=rs("replyer")%></td>
    <td align="center" height="25"><%=rs("replytime")%></td>
    <td align="center" height="25"><a href=../showquestion.asp?id=<%=rs2("id")%> target=_blank>
      <p align="left"><%=rs2("title")%></a></td>
    <td align="center" height="25"><%if rs("isdeal")=1 then%>是<%else%>否<%end if%></td>
    <td align="center" height="25"><input name="del" type="submit" id="del" value="删除"></td>
  </tr></form>
  <%rs2.close
  rs.movenext
  if rs.eof then exit for
  next%>
   <tr>
    <td colspan="6" align="center" bgcolor="#EEEEEE" height="27">
      <p align="left">共<font color=red><%=maxnum%></font>个回复，15个每页，页次:<font color=red><%=p%></font>/<%=maxpage%>
	<a href=adminreply.asp?p=1>首页</a>  
	<a href=adminreply.asp?p=<%=p-1%>>上页</a>  
	<a href=adminreply.asp?p=<%=p+1%>>下页</a>  
	<a href=adminreply.asp?p=<%=maxpage%>>尾页</a></p> 
    </td> 
  </tr>
  <%end if
  rs.close%>
</table>
