Файл: cron/boss2.php
Строк: 81
<?
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)
{
$bosa=mysql_num_rows(mysql_query("SELECT * FROM `boss_usr` WHERE `tip`='boss'"));
if($bosa==0)
{
$t_st=$boss['time_new'];
$bos=mysql_fetch_array(mysql_query("SELECT * FROM `boss` WHERE `id`='".$boss['boss']."'"));
$b_lvl=$bos['lvl']+1;
mysql_query("UPDATE `boss` SET `lvl`='".$b_lvl."' WHERE `id`='".$bos['id']."'");
mysql_query("UPDATE `boss_activ` SET `activ`='0', `boss`='0', `time_start`='".$t_st."', `time_close`='0' WHERE `id`='".$boss['id']."'");
mysql_query("DELETE FROM `boss_usr`");
mysql_query("DELETE FROM `log_boss`");
$reit=mysql_query("SELECT * FROM `boss_reit`");
while($br=mysql_fetch_array($reit))
{
$st1=mysql_fetch_array(mysql_query("SELECT * FROM `boss_reit` ORDER BY `yron` DESC LIMIT 0,1"));
$st2=mysql_fetch_array(mysql_query("SELECT * FROM `boss_reit` ORDER BY `yron` DESC LIMIT 1,1"));
$st3=mysql_fetch_array(mysql_query("SELECT * FROM `boss_reit` ORDER BY `yron` DESC LIMIT 2,1"));
$bez=round($br['yron']/10000);
$bez=$bez+round($bez/100*25);
$us=mysql_fetch_array(mysql_query("SELECT * FROM `users` WHERE `id`='".$br['usr']."'"));
$km=$us['km']+$bez;
mysql_query("UPDATE `users` SET `km`='".$km."' WHERE `id`='".$us['id']."'");
if($st1['id']==$br['id']){
$ms='Так же, за 1 место по урону вы получаете: <font color=#ff2222>Витал Монстробоя I</font> на 3 часа';
$td=time()+3600*3;
mysql_query("INSERT INTO `item` SET
`id`='',
`usr`='".$us['id']."',
`name`='<font color=#ff2222>Витал Монстробоя I</font>',
`img`='3',
`lvl`='1',
`sila`='50',
`hp`='50',
`arm`='50',
`krit`='10',
`blok`='10',
`tip`='vital',
`item`='1',
`status`='off',
`times`='".$td."'
");
}
elseif($st2['id']==$br['id']){
$ms='Так же, за 2 место по урону вы получаете: <font color=#ff2222>Витал Монстробоя II</font> на 3 часа';
$td=time()+3600*3;
mysql_query("INSERT INTO `item` SET
`id`='',
`usr`='".$us['id']."',
`name`='<font color=#ff2222>Витал Монстробоя II</font>',
`img`='3',
`lvl`='1',
`sila`='35',
`hp`='35',
`arm`='35',
`krit`='7',
`blok`='7',
`tip`='vital',
`item`='1',
`status`='off',
`times`='".$td."'
");
}
elseif($st3['id']==$br['id']){
$ms='Так же, за 3 место по урону вы получаете: <font color=#ff2222>Витал Монстробоя III</font> на 3 часа';
$td=time()+3600*3;
mysql_query("INSERT INTO `item` SET
`id`='',
`usr`='".$us['id']."',
`name`='<font color=#ff2222>Витал Монстробоя III</font>',
`img`='3',
`lvl`='1',
`sila`='20',
`hp`='20',
`arm`='20',
`krit`='5',
`blok`='5',
`tip`='vital',
`item`='1',
`status`='off',
`times`='".$td."'
");
}
else
{
$ms='';
}
$text_ok='Битва против Босса: "'.$bos['name'].'" окончена.
Вы нанесли '.$br['yron'].' урона. Ваша награда: Кристалл Монстробоя<img src=img/main/71.png>'.$bez.'<br>
'.$ms.'
';
$rows2_ok=mysql_fetch_array(mysql_query("SELECT * FROM `msg_kont`
WHERE `usr2`='0' and `usr1`='".$us['id']."'"));
mysql_query("UPDATE `msg_kont` SET `read`='1', `time`='".time()."' WHERE `usr2`='0' and `usr1`='".$us['id']."'");
$rows2_oks=mysql_fetch_array(mysql_query("SELECT * FROM `msg_kont`
WHERE `usr2`='0' and `usr1`='".$us['id']."'"));
mysql_query("INSERT INTO `msg_dialog` SET
`id`='',
`dialog`='".$rows2_oks['id']."',
`vhod`='1',
`time`='".time()."',
`text`='".$text_ok."',
`usr`='".$us['id']."'
");
}
mysql_query("DELETE FROM `boss_reit`");
}
else
{
if($boss['time_close']<=time())
{
$t_st=$boss['time_new'];
$bos=mysql_fetch_array(mysql_query("SELECT * FROM `boss` WHERE `id`='".$boss['boss']."'"));
mysql_query("UPDATE `boss_activ` SET `activ`='0', `boss`='0', `time_start`='".$t_st."', `time_close`='0' WHERE `id`='".$boss['id']."'");
mysql_query("DELETE FROM `boss_usr`");
mysql_query("DELETE FROM `log_boss`");
$reit=mysql_query("SELECT * FROM `boss_reit`");
while($br=mysql_fetch_array($reit))
{
$st1=mysql_fetch_array(mysql_query("SELECT * FROM `boss_reit` ORDER BY `yron` DESC LIMIT 0,1"));
$st2=mysql_fetch_array(mysql_query("SELECT * FROM `boss_reit` ORDER BY `yron` DESC LIMIT 1,1"));
$st3=mysql_fetch_array(mysql_query("SELECT * FROM `boss_reit` ORDER BY `yron` DESC LIMIT 2,1"));
$bez=round($br['yron']/10000);
$us=mysql_fetch_array(mysql_query("SELECT * FROM `users` WHERE `id`='".$br['usr']."'"));
$km=$us['km']+$bez;
mysql_query("UPDATE `users` SET `km`='".$km."' WHERE `id`='".$us['id']."'");
if($st1['id']==$br['id']){
$ms='Так же, за 1 место по урону вы получаете: <font color=#ff2222>Витал Монстробоя I</font> на 3 часа';
$td=time()+3600*3;
mysql_query("INSERT INTO `item` SET
`id`='',
`usr`='".$us['id']."',
`name`='<font color=#ff2222>Витал Монстробоя I</font>',
`img`='3',
`lvl`='1',
`sila`='50',
`hp`='50',
`arm`='50',
`krit`='10',
`blok`='10',
`tip`='vital',
`item`='1',
`status`='off',
`times`='".$td."'
");
}
elseif($st2['id']==$br['id']){
$ms='Так же, за 2 место по урону вы получаете: <font color=#ff2222>Витал Монстробоя II</font> на 3 часа';
$td=time()+3600*3;
mysql_query("INSERT INTO `item` SET
`id`='',
`usr`='".$us['id']."',
`name`='<font color=#ff2222>Витал Монстробоя II</font>',
`img`='3',
`lvl`='1',
`sila`='35',
`hp`='35',
`arm`='35',
`krit`='7',
`blok`='7',
`tip`='vital',
`item`='1',
`status`='off',
`times`='".$td."'
");
}
elseif($st3['id']==$br['id']){
$ms='Так же, за 3 место по урону вы получаете: <font color=#ff2222>Витал Монстробоя III</font> на 3 часа';
$td=time()+3600*3;
mysql_query("INSERT INTO `item` SET
`id`='',
`usr`='".$us['id']."',
`name`='<font color=#ff2222>Витал Монстробоя III</font>',
`img`='3',
`lvl`='1',
`sila`='20',
`hp`='20',
`arm`='20',
`krit`='5',
`blok`='5',
`tip`='vital',
`item`='1',
`status`='off',
`times`='".$td."'
");
}
else
{
$ms='';
}
$text_ok='Битва против Босса: "'.$bos['name'].'" окончена.
Вы нанесли '.$br['yron'].' урона. Ваша награда: Кристалл Монстробоя<img src=img/main/71.png>'.$bez.'<br>
'.$ms.'
';
$rows2_ok=mysql_fetch_array(mysql_query("SELECT * FROM `msg_kont`
WHERE `usr2`='0' and `usr1`='".$us['id']."'"));
mysql_query("UPDATE `msg_kont` SET `read`='1', `time`='".time()."' WHERE `usr2`='0' and `usr1`='".$us['id']."'");
$rows2_oks=mysql_fetch_array(mysql_query("SELECT * FROM `msg_kont`
WHERE `usr2`='0' and `usr1`='".$us['id']."'"));
mysql_query("INSERT INTO `msg_dialog` SET
`id`='',
`dialog`='".$rows2_oks['id']."',
`vhod`='1',
`time`='".time()."',
`text`='".$text_ok."',
`usr`='".$us['id']."'
");
}
mysql_query("DELETE FROM `boss_reit`");
}
}
}
?>