Файл: cron/boss.php
Строк: 23
<?
define('PROTECTOR', 1);
$db_host = "localhost";
$db_user = "root";
$db_table = "sidonia";
$db_pass = "";
$connect = @ mysql_pconnect($db_host, $db_user, $db_pass) or die('cannot connect to server');
@ mysql_select_db($db_table) or die('cannot connect to db');
@ mysql_query("SET NAMES 'utf8'", $connect);
$boss=mysql_fetch_array(mysql_query("SELECT * FROM `boss_activ` WHERE `id`='1'"));
if($boss['activ']==0)
{
if($boss['time_start']<=time())
{
$bs=rand(1,4);
$t_st=time();
$t_fh=$t_st+7200;
$t_fhz=$t_st+10800;
$t_new=$t_st+21600;
mysql_query("UPDATE `boss_activ` SET `activ`='1', `boss`='".$bs."', `time_start`='".$t_st."', `time_close`='".$t_fh."', `time_rez`='".$t_fhz."', `time_new`='".$t_new."' WHERE `id`='".$boss['id']."'");
$bos=mysql_fetch_array(mysql_query("SELECT * FROM `boss` WHERE `id`='".$bs."'"));
$lvlb=$bos['lvl']-1;
$bos['hp']=$bos['hp']+$lvlb*$bos['lvl_hp'];
$bos['sila']=$bos['sila']+$lvlb*$bos['lvl_sila'];
$bos['arm']=$bos['arm']+$lvlb*$bos['lvl_arm'];
mysql_query("INSERT INTO `boss_usr` SET
`id`='',
`tip`='boss',
`name`='".$bos['name']."',
`hp`='".$bos['hp']."',
`arm`='".$bos['arm']."',
`sila`='".$bos['sila']."'
");
}
}
?>