Файл: data/optimize.php
Строк: 26
<?php
$dbhost="localhost";
$dbname="andking_wk";
$dbuser="andking";
$dbpass="baza1212";
$lin=mysql_connect($dbhost,$dbuser,$dbpass) or die("Не могу подключиться к серверу БД");
mysql_select_db($dbname,$lin) or die("Не могу подключиться к БД");
mysql_query("SET NAMES utf8");
mysql_query("set character_set_client='utf8'");
mysql_query("set character_set_results='utf8'");
mysql_query("set collation_connection='utf8'");
$time=time();
$req = mysql_query("SELECT `account` FROM `arena_travma` WHERE `time`<'$time' ");
////////////////////////////
$avto=mysql_num_rows($req);
if($avto>=1){
While($mag = mysql_fetch_array($req))
{
mysql_query("UPDATE `account` SET `arena_status`= 'on' WHERE `id`= '$mag[account]' ");
mysql_query("DELETE FROM `arena_travma` WHERE `account`='$mag[account]' ");
}}
$at = mysql_query('SHOW TABLES'); //Оптимизируем MySql
while ($tables = mysql_fetch_assoc($at))
{
foreach ($tables as $bd => $table)
{
mysql_query('OPTIMIZE TABLE `'.trim($table).'`')
or die(mysql_error());
}
}
?>