Файл: accmarket.net/4.php
Строк: 27
<?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 `sector_loc` WHERE `loc`=2 OR `loc`=3 ORDER BY `id` DESC");
if($PAGINGS > 0)
{
while($row = mysql_fetch_array($PAGINGS))
{
echo '<div class="conts">x:'.$row['x'].' y:'.$row['y'].'<br/>';
$r=rand(1, 10);
if($r>=5)$count = mysql_result(mysql_query("SELECT (tmarat) FROM `users` WHERE `id`='".$row['uid']."';"), 0);
if($r>=5 AND $realtime>=$row['time'] AND $row['loc']==2 AND $count>$realtime){
$xd=rand(1, 4);
echo ''.met($xd).'';
mysql_query("INSERT INTO `doklad` SET `uid`='".$row['uid']."', `time`='" . time() . "', `type`=4, `text`='".met($xd)." приближается к вашей планете. Координаты x:".($row['x']+1)." y:".($row['y']+1).". До падения осталось 360 минут.';");
mysql_query("UPDATE `sector_loc` SET `time`='".(time()+43200)."' WHERE `id`='".$row['id']."';");
mysql_query("INSERT INTO `sector_loc` SET `uid`='".$row['uid']."', `x`='".($row['x']+1)."', `y`='".($row['y']+1)."', `loc`=3, `type`='".$xd."', `planet`='".$row['planet']."', `time`='".(time()+21550)."';");
}
if($realtime>=$row['time'] AND $row['loc']==3){
echo ''.met($row['type']).'';
$q = mysql_query("SELECT * FROM `planet` WHERE `id`='".$row['planet']."'");
$f = mysql_fetch_array($q);
$pd=intval(($f['peo']/100)*($row['type']*10));
if($pd>$f['peo'])$pd=$f['peo'];
mysql_query("INSERT INTO `doklad` SET `uid`='".$row['uid']."', `time`='" . time() . "', `type`=4, `text`='".met($row['type'])." упал(а) на вашу планету <b>".$f['name']."</b>. Координаты x:".($row['x']-1)." y:".($row['y']-1).". Погибло ".$pd." (".($row['type']*10)."%) населения';");
mysql_query("DELETE FROM `sector_loc` WHERE `id`='".$row['id']."';");
mysql_query("UPDATE `planet` SET `peo`=peo-'".$pd."' WHERE `id`='".$row['planet']."';");
}
echo '</div>';
}}
div('<a href="../">На главную</a>','downban');
require_once '../includes/footer.php';
?>