<? 
 include './system/common.php';
 include './system/functions.php'; 
 include './system/user.php';
if(!$user) {
 header('location: /');
exit;

}
$title='Исскуственный онлайн';
include './system/h.php';
if(isset($_GET['launch'])){
 $online=_num($_POST['k']);

 $q=mysql_query("SELECT * FROM `users` WHERE `online`<'".(time() - (60 * 10))."' ORDER BY rand() LIMIT $online");
 if(mysql_num_rows($q)=='0'){
 $_SESSION['light']="Успешно";
 header("Location:?");
 exit;
 }
 while($a=mysql_fetch_array($q)){
 
 mysql_query("UPDATE `users` SET `online`='".(time()-(60*20))."' WHERE `id`='".$a['id']."'");
 $_SESSION['light']="Исскуственный онлайн успешно установлен на $launch игроков";
 header("Location:?");
 }
}

if(isset($_GET['offline'])){
 $online=_num($_POST['k']);

 $q=mysql_query("SELECT * FROM `users` WHERE `online`>'".(time() - (60 * 20))."' ORDER BY rand() LIMIT $online");
 if(mysql_num_rows($q)=='0'){
 $_SESSION['light']="Успешно";
 header("Location:?");
 exit;
 }
 while($a=mysql_fetch_array($q)){
 
 mysql_query("UPDATE `users` SET `online`='".(time()-(60*20))."' WHERE `id`='".$a['id']."'");
 $_SESSION['light']="Исскуственный онлайн успешно установлен на $launch игроков";
 header("Location:?");
 }
}

?>
<div class="line"></div>
<div class="content">Онлайн</div>
<div class="line"></div>
<div class="content">
<form action='?launch' method='post'/>
<input type='text' name='k' placeholder='Только цифры'/>
<input type='submit' value='Включить'/>
</form>

</div>
<div class="line"></div>
<div class="content">Оффлайн</div>
<div class="line"></div>
<form action='?offline' method='post'/>
<input type='text' name='k' placeholder='Только цифры'/>
<input type='submit' value='Выключить'/>
</form>
<div class="line"></div>
<div class="content">
</div>
<?
include './system/f.php';
?>