    <?
    include '../system/common.php';
    
 include '../system/functions.php';
        
      include '../system/user.php';
    
if(!$user OR $user['access']<3 or $user['id'] >1) {

  header('location: /menu');
    
exit;

}



$title = 'Чистка';    

include '../system/h.php';  



if($_GET[del]==user) {
mysql_query("DELETE FROM `users` WHERE `save` = '0'");
header('location:?');
}
$skok = mysql_num_rows( mysql_query('SELECT * FROM `users` WHERE `save` = "0"') );






if($_POST['submit']) {


$id = _num($_POST['id']);
$type = _num($_POST['type']);
$users = mysql_fetch_assoc(mysql_query("SELECT * FROM `users` WHERE `id` = ".$id."")); 


  if(!$users OR $type < 0 OR $type > 3) exit(header('location: /admin/spam.php'));


// Type
if($type == 1) {

mysql_query("DELETE FROM `chat` WHERE `user` = ".$users['id']."");

}

if($type == 2) {
mysql_query("DELETE FROM `forum_topic` WHERE `user` = ".$users['id']."");
mysql_query("DELETE FROM `forum_comments` WHERE `user` = ".$id."");
header('location:?');
}

if($type == 3) {
mysql_query("DELETE FROM `mail` WHERE `from` = ".$id."");
mysql_query("DELETE FROM `mail` WHERE `to` = ".$id."");
mysql_query("DELETE FROM `contacts` WHERE `ho` = ".$id."");
mysql_query("DELETE FROM `contacts` WHERE `user` = ".$id."");
header('location:?');
}

}

?>
<br><font color='lime' size=2px>Несохроненые игроки</font>: <?=$skok?> (<a href='?del=user'>Удалить все</a>)

<form action='' method='post'>
ID персонажа: <br />
<input name='id'/>
<select name='type'>
<option value='1'>Чат</option>
<option value='2'>Форум</option>
<option value='3'>Почта</option>
</select><br />


<div class='mini-line'></div>
<input type='submit' name='submit' value='Очистить' class='button'>
</form> 
<?
include ''.$_SERVER['DOCUMENT_ROOT'].'/system/f.php';
?>
