Файл: accmarket.net/cron/3.php
Строк: 38
<?php
define('_ON_CMS', 1);
require_once '../includes/start.php';
require_once '../includes/function.php';
require_once '../includes/header.php';
$PAGINGS = mysql_query("SELECT * FROM `planet` WHERE `peo`!=0 ORDER BY `id` DESC");
if($PAGINGS > 0)
{
while($row = mysql_fetch_array($PAGINGS))
{
$q = mysql_query("SELECT * FROM `users` WHERE `id`='".check(mysql_real_escape_string($row['uid']))."'");
$f = mysql_fetch_array($q);
if($f['prov']>=$row['peo']*0.5){
if($row['peo']<(1750*$row['maxpeo']) AND $row['peo']>=50000 AND $f['rasa']==1)$p=intval($row['peo']/40);
if($row['peo']<(1750*$row['maxpeo']) AND $row['peo']<50000 AND $f['rasa']==1)$p=intval($row['peo']/13.3);
if($row['peo']>=(1750*$row['maxpeo']) AND $f['rasa']==1)$p=rand(2,5);
if($row['peo']<(1500*$row['maxpeo']) AND $row['peo']>=25000 AND $f['rasa']==2)$p=intval($row['peo']/50);
if($row['peo']<(1500*$row['maxpeo']) AND $row['peo']<25000 AND $f['rasa']==2)$p=intval($row['peo']/16.6);
if($row['peo']>=(1500*$row['maxpeo']) AND $f['rasa']==2)$p=rand(1,4);
if($row['peo']<(2000*$row['maxpeo']) AND $row['peo']>=75000 AND $f['rasa']==3)$p=intval($row['peo']/30);
if($row['peo']<(2000*$row['maxpeo']) AND $row['peo']<75000 AND $f['rasa']==3)$p=intval($row['peo']/10);
if($row['peo']>=(2000*$row['maxpeo']) AND $f['rasa']==3)$p=rand(3,6);
$e=$f['prov']-$row['peo']*0.5;
mysql_query("UPDATE `users` SET `prov`=$e WHERE `id`='".$row['uid']."';");
mysql_query("UPDATE `planet` SET `peo`=peo+$p WHERE `id`='".$row['id']."';");
mysql_query("INSERT INTO `doklad` SET `uid`='".$row['uid']."', `time`='" . time() . "', `type`=1, `text`='Прирост населения на планете <b>".$row['name']."</b> + ".$p." ед.!';");
}else{
$p=intval($row['peo']-$f['prov']*2);
$e=0;
mysql_query("UPDATE `users` SET `prov`=$e WHERE `id`='".$row['uid']."';");
mysql_query("UPDATE `planet` SET `peo`=peo-$p WHERE `id`='".$row['id']."';");
mysql_query("INSERT INTO `doklad` SET `uid`='".$row['uid']."', `time`='" . time() . "', `type`=1, `text`='На планете <b>".$row['name']."</b> от голода погибло ".$p." населения!';");}
}}
$PAGINGS1 = mysql_query("SELECT * FROM `planet` WHERE `peo`=0 AND `repeo`=0 ORDER BY `id` DESC");
if($PAGINGS1 > 0)
{
while($row1 = mysql_fetch_array($PAGINGS1))
{
if($row1['rasa']==1)$npeople=1000;
if($row1['rasa']==2)$npeople=750;
if($row1['rasa']==3)$npeople=1250;
mysql_query("UPDATE `planet` SET `peo`='".$npeople."', `repeo`=1 WHERE `id`='".$row1['id']."';");
mysql_query("INSERT INTO `doklad` SET `uid`='".$row1['uid']."', `time`='" . time() . "', `type`=1, `text`='На планету <b>".$row1['name']."</b> прибыло ".$npeople." населения! Внимательно следите за приростом населения так как теперь если оно закончится новые колонисты уже не прибудут';");
}}
div('<a href="../">На главную</a>','downban');
require_once '../includes/footer.php';
?>