<?php
include(dirname(__FILE__)."/require.php");
if($ppurview[16]!=1)
{
  Header("Location: jump.php?id=25&jump=main.php");
  exit();
}
if(isset($_GET['action']) and $_GET['action']="del")
{
  if($_POST['theme']!="")
  {
    $where="theme like '%".$_POST['theme']."%'";
    if($_POST['barname']!="")
      $where=$where."and belong='".$_POST['barname']."'";
    if($_POST['author']!="")
      $where=$where."and author='".$_POST['author']."'";
  }
  elseif($_POST['barname']!="")
  {
    $where="belong='".$_POST['barname']."'";
    if($_POST['author']!="")
      $where=$where."and author='".$_POST['author']."'";
  }
  elseif($_POST['author']!="")
    $where="author='".$_POST['author']."'";
  else
    Header("Location: jump.php?id=24&jump=del.php");
  $phpcolor->table=$core_mysql_prefix."topic";
  $phpcolor->field="id";
  $phpcolor->where=$where;
  $rs=$phpcolor->assignment();
  $phpcolor->field="state = 0";
  $phpcolor->upgrade();
  for($count=0;$count<count($rs);$count++)
  {
    $time=date('Y-m-d H:i:s',strtotime(date('Y-m-d H:i:s'))+$core_time*60*60);
    $phpcolor->table=$core_mysql_prefix."recover";
    $phpcolor->field="tid, operate, operatetime, ip, type";
    $phpcolor->where="'".$rs[$count]['id']."', '".$_COOKIE["core_user_name"]."','".$time."','".$_SERVER['REMOTE_ADDR']."' , '1'";
    $phpcolor->write();
  }
  Header("Location: jump.php?id=24&jump=del.php");
}
else
  $tpl -> display("del.htm");
?>