Файл: accmarket.net/cron/rabota.php
Строк: 79
<?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 `rabota` WHERE `time` < '".$realtime."' ORDER BY `id` DESC");
if($PAGINGS > 0)
{
while($row = mysql_fetch_array($PAGINGS))
{
if($row['typerab']==1){
mysql_query("UPDATE `users` SET `lvl_hero`='".$row['number']."' WHERE `id`='".$row['uid']."';");
mysql_query("INSERT INTO `doklad` SET `uid`='".$row['uid']."', `time`='" . time() . "', `type`=0, `text`='Ваш герой повышен до ".$row['number']." уровня';");
}
if($row['typerab']==2){
$bb='b'.$row['type'].'';
mysql_query("UPDATE `building` SET `$bb`=1 WHERE `planet_id`='".$row['planet']."';");
mysql_query("INSERT INTO `doklad` SET `uid`='".$row['uid']."', `time`='" . time() . "', `type`=0, `text`='Постройка на планете <b>".$row['name_planet']."</b> завершена: ".b($row['type'], $row['rasa'])."';");
}
if($row['typerab']==3){
mysql_query("UPDATE `planet` SET `rab`=rab+'".$row['number']."' WHERE `id`='".$row['planet']."';");
mysql_query("INSERT INTO `doklad` SET `uid`='".$row['uid']."', `time`='" . time() . "', `type`=2, `text`='Обучение на планете <b>".$row['name_planet']."</b> ".rab1($row['rasa']).": ".$row['number']." завершено';");
}
if($row['typerab']==4){
$bb='s'.$row['type'].'';
mysql_query("UPDATE `science` SET `$bb`='".$row['number']."' WHERE `planet_id`='".$row['planet']."';");
mysql_query("INSERT INTO `doklad` SET `uid`='".$row['uid']."', `time`='" . time() . "', `type`=0, `text`='Исследование на планете <b>".$row['name_planet']."</b> завершено: ".science($row['type'])." [".$row['number']."]';");
}
if($row['typerab']==5){
mysql_query("UPDATE `planet` SET `maxpeo`=maxpeo+1 WHERE `id`='".$row['planet']."';");
mysql_query("INSERT INTO `doklad` SET `uid`='".$row['uid']."', `time`='" . time() . "', `type`=0, `text`='Дополнительное ".b(2, $row['rasa'])." на планете <b>".$row['name_planet']."</b> пристроено';");
}
if($row['typerab']==6){
mysql_query("UPDATE `planet` SET `razv`='".$row['number']."' WHERE `id`='".$row['planet']."';");
mysql_query("INSERT INTO `doklad` SET `uid`='".$row['uid']."', `time`='" . time() . "', `type`=0, `text`='Уровень разведки на планете <b>".$row['name_planet']."</b> поднят до ".$row['number']."%';");
}
if($row['typerab']==7){
$rur='r'.$row['type'].'';
mysql_query("UPDATE `units` SET `$rur`='".$row['number']."' WHERE `uid`='".$row['uid']."';");
mysql_query("INSERT INTO `doklad` SET `uid`='".$row['uid']."', `time`='" . time() . "', `type`=0, `text`='Ранг юнита <b>".units($row['type'], $row['rasa'])."</b> повышен до ".$row['number']."';");
}
if($row['typerab']==8){
$un='u'.$row['type'].'';
mysql_query("UPDATE `planet_units` SET `$un`=$un+'".$row['number']."' WHERE `planet`='".$row['planet']."';");
mysql_query("INSERT INTO `doklad` SET `uid`='".$row['uid']."', `time`='" . time() . "', `type`=2, `text`='Обучение на планете <b>".$row['name_planet']."</b> ".units($row['type'], $row['rasa']).": ".$row['number']." завершено';");
}
if($row['typerab']==9){
mysql_query("UPDATE `planet` SET `raket`=raket+1 WHERE `id`='".$row['planet']."';");
mysql_query("INSERT INTO `doklad` SET `uid`='".$row['uid']."', `time`='" . time() . "', `type`=0, `text`='Постройка на планете <b>".$row['name_planet']."</b> завершена: ".units($row['type'], $row['rasa'])."';");
}
if($row['typerab']==10){
$typeart=rand(1,10);
$randart=rand(1,100);
if($randart>=1 AND $randart<=70)$lvlart=1;
if($randart>70 AND $randart<=90)$lvlart=2;
if($randart>90 AND $randart<=100)$lvlart=3;
mysql_query("UPDATE `art` SET `isl`=1, `type`='".$typeart."', `lvl`='".$lvlart."' WHERE `id`='".$row['type']."';");
mysql_query("INSERT INTO `doklad` SET `uid`='".$row['uid']."', `time`='" . time() . "', `type`=0, `text`='Исследование неизвестного артефакта на планете <b>".$row['name_planet']."</b> завершено: ".art($typeart, $lvlart)."';");
}
if($row['rab']!=0)mysql_query("UPDATE `planet` SET `rab`=rab+'".$row['rab']."' WHERE `id` = '".$row['planet']."';");
}}
mysql_query("DELETE FROM `rabota` WHERE `time` < '".$realtime."';");
div('<a href="../">На главную</a>','downban');
require_once '../includes/footer.php';
?>