Уменьшил. Убрал deprecated.

This commit is contained in:
Igor Barkov [iwork] 2018-12-13 16:52:02 +02:00
parent 0714838bf9
commit fad59398f1

View File

@ -1,74 +1,27 @@
<?
include("config.php");
$nowtime = time();
<?php
require_once "../config.php";
// Осталось понять что делает, зачем написан и какой интервал запуска.
// 4 hours: time() + 14400;
$info_pole = mysql_fetch_array(mysql_query("SELECT `value` FROM `variables` WHERE `var` = 'pole_random' LIMIT 1"));
$q = db::c()->query('SELECT `value` FROM `variables` WHERE `var` = "?s"', 'pole_random')->fetch_assoc();
$ff_time = time();
$f_time = $ff_time + 14400;
if($info_pole['value'] == '') {
for ($i = 0; $i < 41; $i++) {
$hrand = rand(1, 11)/10;
$rand = rand(1, 9);
$rekrr = 30/30;
$rekr = rand(1, $rekrr)/10;
$bonus = rand(1, 13)/10;
$bonuss = $rekr*$bonus;
$rekrr = $rekr+$bonuss;
if($rand == 1) {
$h = 100;
} elseif($rand == 2) {
$h = 80;
} elseif($rand == 3) {
$h = 70;
} elseif($rand == 4) {
$h = 60;
} elseif($rand == 5) {
$h = 50;
} elseif($rand == 6) {
$h = 40;
} elseif($rand == 7 || $rand == 8 || $rand == 9) {
$h = 0;
$rand = mt_rand(1, 9);
if ($rand == 1) $h = 100;
elseif ($rand == 2) $h = 80;
elseif ($rand == 3) $h = 70;
elseif ($rand == 4) $h = 60;
elseif ($rand == 5) $h = 50;
elseif ($rand == 6) $h = 40;
elseif ($rand == 7 || $rand == 8 || $rand == 9) $h = 0;
$h += $h * mt_rand(1, 11) / 10;
$rekr = 0.1 + mt_rand(1, 13) / 100;
db::c()->query('UPDATE `pole` SET `type` = ?i, `heals` = ?i, `ekr` = ?i WHERE `id` = ?i', $rand, $h, $rekr, $i);
}
$hh = $h*$hrand;
$h = $h+$hh;
mysql_query("UPDATE `pole` SET `type` = '".$rand."', `heals` = '".$h."', `ekr` = '".$rekrr."' WHERE `id` = '".$i."' LIMIT 1");
}
mysql_query("UPDATE `variables` SET `value` = '".$f_time."' WHERE `var` = '".$info_pole['var']."' LIMIT 1");
} else{
if($info_pole['value'] < $nowtime){
for($i = 0; $i < 41; $i++) {
$hrand = rand(1, 11)/10;
$rand = rand(1, 9);
$rekrr = 30/30;
$rekr = rand(1, $rekrr)/10;
$bonus = rand(1, 13)/10;
$bonuss = $rekr*$bonus;
$rekrr = $rekr+$bonuss;
if($rand == 1) {
$h = 100;
} elseif($rand == 2) {
$h = 80;
} elseif($rand == 3) {
$h = 70;
} elseif($rand == 4) {
$h = 60;
} elseif($rand == 5) {
$h = 50;
} elseif($rand == 6) {
$h = 40;
} elseif($rand == 7 || $rand == 8 || $rand == 9) {
$h = 0;
}
$hh = $h * $hrand;
$h = $h + $hh;
mysql_query("UPDATE `pole` SET `type` = '".$rand."', `heals` = '".$h."', `ekr` = '".$rekrr."' WHERE `id` = '".$i."' LIMIT 1");
}
mysql_query("UPDATE `variables` SET `value` = `value`+'14400' WHERE `var` = '".$info_pole['var']."' LIMIT 1");
}
}
?>
if (empty($q['value']))
db::c()->query('UPDATE `variables` SET `value` = ?i WHERE `var` = "?s"', (time() + 14400), 'pole_random');
elseif ($q['value'] < time())
db::c()->query('UPDATE `variables` SET `value` = `value` + 14400 WHERE `var` = "?s"', 'pole_random');