Файл: accmarket.net/cron/res.php
Строк: 26
<?php
define('_ON_CMS', 1);
require_once '../includes/start.php';
require_once '../includes/function.php';
require_once '../includes/header.php';
div('Добыча ресурсов','top');
function res1($level)
{
if($level==2)$status='min';
if($level==3)$status='gas';
if($level==4)$status='metall';
if($level==5)$status='water';
if($level==6)$status='kred';
if($level==7)$status='prov';
return $status;
}
$PAGINGS = mysql_query("SELECT * FROM `planet_loc` WHERE `type`>=2 AND `rab`!=0 AND `res`>0 AND `occupy`=0 ORDER BY `id` DESC");
if($PAGINGS > 0)
{
while($row = mysql_fetch_array($PAGINGS))
{
$s='s'.$row['type'].'';
$r=''.res1($row['type']).'';
$science = mysql_result(mysql_query("SELECT ($s) FROM `science` WHERE `planet_id`='".$row['planet_id']."';"), 0);
$plus=$row['rab']*($science*0.3);
if($row['rab']>$row['res'])$plus=$row['res']*($science*0.3);
$rab=$row['rab'];
if($rab>$row['res'])$rab=$row['res'];
mysql_query("UPDATE `users` SET `$r`=$r+$plus WHERE `id`='".$row['uid']."';");
mysql_query("UPDATE `planet_loc` SET `res`=res-'".$rab."' WHERE `id`='".$row['id']."';");
}
}
div('<a href="../">На главную</a>','downban');
require_once '../includes/footer.php';
?>