<?php if(!defined('FastCore')){ exit('Oops!'); }

?>
<h3>Рестарт проекта 777</h3>

<div class="p-2">
<?PHP

if(isset($_POST["restart"])){

# Чистим список

$db->Query("TRUNCATE TABLE `db_bonus`");
$db->Query("TRUNCATE TABLE `db_insert`");
$db->Query("TRUNCATE TABLE `db_payout`");
$db->Query("TRUNCATE TABLE `db_loto_wins`");
$db->Query("TRUNCATE TABLE `db_liders`");
$db->Query("TRUNCATE TABLE `db_surf`");
$db->Query("TRUNCATE TABLE `db_surf_views`");
$db->Query("UPDATE db_stats SET `inserts` = '0', `payments` = '0', `views` = '0'");

$time = time();

# Пользователей обнуляем
$counter = 1;
$ok = $db->query('SELECT * FROM db_users')->fetchAll();

	foreach($ok as $u) {

	$user_idd = $u['id'];

# tarif params
$idTarif = 1;
$speed = 500;
$price = 50;
$hashpower = round($price,0);
$periodData = 15;
$title = 'Plan - '.$idTarif.'';
$period = $time+60*60*24*$periodData;
$db->query("INSERT INTO db_store (uid, tarif, title, speed, hashpower, `add`, `end`, `status`, `last`) VALUES ('$user_idd', '$idTarif', '$title', '$speed', '$hashpower', '$time', '$period', '1' , '$time')");

# Обнуляем
 $ddd = $db->query('UPDATE db_users SET freebet = ?, earn_bonus = ?, money_p = ?, money_b = ?, sum_in = ?, sum_out = ?, ref_to = ?, ref_views = ?, income = ?, surf_view = ?, surf_earn = ?, bank = ?, bankin = ?, bankout = ?, speed = ?, last = ? WHERE id = ?','0','0','0','0','0','0','0','0','0','0','0', $hashpower, '0', '0', $speed, $time, $user_idd);

	$counter++;
	} echo '<div class="alert alert-success"><b>ГОТОВО!</b><br/> Все балансы обнулены</div>';
}

?>

<form action="" method="post" class="mb-0">
После нажатия отменить будет невозможно <br/>
<input type="submit" name="restart" class="btn btn-success mt-2" style="font-weight: bold;" value="РЕСТАРТ ПРОЕКТА"> 
</form>

</div>