<%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">
  <tr>
    <td height="20" colspan="11" align="center" bgcolor="#EFEFEF"><font style="font-size:14px">删除用户</font></td>
  </tr>
  <%if request("del")="删除" then
  '删除用户以及相关问题和回复
  rs.open"select * from person where id="&cint(request("id")),conn,1,3
  rs2.open"select * from reply where replyer='"&rs("name")&"'",conn,1,1
  while not rs2.eof
  if rs2("isdeal")=1 then
  rs3.open"select * from question where id="&rs2("replyid")&"",conn,1,3
  rs3("jie")=0
  rs3("jieuser")=Null
  rs3.update
  rs3.close
  rs3.open"select * from pj where jiaid="&rs2("replyid")&"",conn,1,3
  while not rs3.eof
  rs3.delete
  rs3.movenext
  wend
  rs3.close
  end if
  rs2.movenext
  wend
  rs2.close
  rs2.open"select * from reply where replyer='"&rs("name")&"'",conn,1,3
  while not rs2.eof
  rs2.delete
  rs2.movenext
  wend
  rs2.close
  rs2.open"select * from question where sender='"&rs("name")&"'",conn,1,3
  while not rs2.eof
  rs3.open"select * from reply where replyid="&rs2("id"),conn,1,3
  while not rs3.eof
  rs3.delete
  rs3.movenext
  wend
  rs3.close
  rs2.movenext
  wend
  rs2.close
  rs3.open"select * from ping where pingname='"&rs("name")&"'",conn,1,3
  while not rs3.eof
  rs3.delete
  rs3.movenext
  wend
  rs3.close
  rs3.open"select * from pj where pjuser='"&rs("name")&"'",conn,1,3
  while not rs3.eof
  rs3.delete
  rs3.movenext
  wend
  rs3.close
  rs3.open"select * from toupiao where dauser='"&rs("name")&"'",conn,1,3
  while not rs3.eof
  rs3.delete
  rs3.movenext
  wend
  rs3.close
  rs3.open"select * from touuser where touuser='"&rs("name")&"'",conn,1,3
  while not rs3.eof
  rs3.delete
  rs3.movenext
  wend
  rs3.close
  rs3.open"select * from zhuanjia where user='"&rs("name")&"'",conn,1,3
  while not rs3.eof
  rs3.delete
  rs3.movenext
  wend
  rs3.close
  rs.delete
  rs.close
  '
  response.write"<tr><td colspan=10>用户删除成功!</td></tr><meta http-equiv=refresh content='1;url=adminperson.asp'>"
  response.End()
  end if%>
  <tr>
    <td align="center">用户名</td><td align="center">qq</td>
    <td align="center">用户email</td>
    <td align="center">积分</td>
    <td align="center">头衔</td>
    <td align="center">发表</td>
    <td align="center">回复</td>
    <td align="center">解决</td>
    <td align="center">被删</td>
    <td align="center">注册时间</td>
    <td align="center">操作</td>
  </tr>
  <%rs.open"select * from person order by jifen desc",conn,1,1
  if rs.eof then
  %>
  <tr>
    <td colspan="11">暂时没有用户!</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%>
  <form method=post action=adminperson.asp?id=<%=rs("id")%>>
  <tr>
    <td align="center"><a href=../showperson.asp?id=<%=rs("id")%> target=_blank><%=rs("name")%></a></td><td width="43" align="center"><%=rs("qq")%>&nbsp;</td>
    <td align="center"><%=rs("email")%>&nbsp;</td>
    <td align="center"><font color=green><%=rs("jifen")%></font></td>
    <td align="center"><%=rs("touxian")%></td>
    <td align="center"><%=rs("asknum")%></td>
    <td align="center"><%=rs("replynum")%></td>
    <td align="center"><%=rs("helpnum")%></td>
    <td align="center"><%=rs("del")%></td>
    <td align="center"><%=rs("time")%></td>
    <td align="center"><input name="del" type="submit" id="del" value="删除"></td>
  </tr>
  </form>
  <%rs.movenext
  if rs.eof then exit for
  next%><tr>
    <td colspan="11" bgcolor="#EFEFEF">共有<font color=red><%=maxnum%></font>个用户，15个每页，页次:<font color=red><%=p%></font>/<%=maxpage%>
	<a href=adminperson.asp?p=1>首页</a>    
	<a href=adminperson.asp?p=<%=p-1%>>上页</a>    
	<a href=adminperson.asp?p=<%=p+1%>>下页</a>    
	<a href=adminperson.asp?p=<%=maxpage%>>尾页</a></td>    
  </tr>
  <%end if
  rs.close%>
</table>
