Файл: impwar.tk/conf/top.php
Строк: 398
<?php
$reg=abs(intval($_SESSION['id']));
$user=$dbc->query("select * from users where id = '$reg' limit 1")->fetch_assoc();
$row=$dbc->query("select * from regeneration where user_id = '$reg' limit 1")->fetch_assoc();
$query = "Select * from `regeneration` WHERE `user_id` = '$reg' LIMIT 1";
$for= mysqli_query($dbc, $query) or die ('Ошибка передачи запроса к БД');
$avto = mysqli_num_rows($for);
$time= time()+30;
if($avto==0){
$pdo->exec("INSERT INTO `regeneration` SET `user_id` = '$reg', `time`='$time'");}
if($row[time]<=time()){
$pdo->exec("UPDATE regeneration SET time = '$time' WHERE id = '$reg'");
if($user[sutost]>0){
$pdo->exec("UPDATE users SET sutost =sutost-1 WHERE id = '$reg'");}
}
$time_beg=microtime();
$user_top = abs(intval($_SESSION['id']));
$query_hp = "Select * from users where id = '$user_top'";
$result_hp = mysqli_query($dbc, $query_hp) or die ('Ошибка передачи запроса к БД');
$row_hp = mysqli_fetch_array($result_hp);
$mes = $pdo->query("SELECT COUNT(id) FROM `messages` WHERE `komy` = '".$user_top."' and
`readlen` = '0'")->fetchColumn();
$hp = $row_hp['hp'];
$lvl = $row_hp['lvl'];
$read_ad = $row_hp['read_ad'];
$gruppa_inv = $row_hp['gruppa'];
$location = $row_hp['location'];
$antirad_time = $row_hp['antirad_time'];
$radiation = $row_hp['radiation'];
$regen = $row_hp['regen'];
$mentor_time = $row_hp['mentor_time'];
$mentor_type = $row_hp['mentor_type'];
$max_hp = $row_hp['max_hp'];
$last_active = $row_hp['last_active'];
$clan_ad = $row_hp['clan'];
$now = (date("Y-m-d H:i:s"));
$last_active = strtotime("$last_active");
$now=strtotime("$now");
/////////////////////////////////////////////////Атака всякой нечести:)
$m_fight=$row_hp['m_fight'];
if ($m_fight<> 0) {
$query_at = "Select id_monster, hp, start, last_active, time_start, clan_id from m_fight where id_fight= '$m_fight' limit 1";
$result_at = mysqli_query($dbc, $query_at) or die ('Ошибка передачи запроса к БД2');
$row_at = mysqli_fetch_array($result_at);
if (!empty($row_at)) {
if ($row_at['start'] == 1 and $row_at['hp'] > 0) {
$m_at = $row_at['id_monster'];
$query_m = "Select name, screen, clan, max_people, max_hp, bronya, yron, speed, bonus_type, bonus, location, time_angry, location_name, respawn_time, max_aptechki from monsters where id_monster = '$m_at' limit 1";
$result_m = mysqli_query($dbc, $query_m) or die ('Ошибка передачи запроса к БД2');
$row_m = mysqli_fetch_array($result_m);
$max_people=$row_m['max_people'];
$max_hp_m=$row_m['max_hp'];
$loca=$row_m['location'];
///////////////////////РАНДОМНАЯ Атака Монстра
$now = (date("Y-m-d H:i:s"));
$now = strtotime("$now");
$last_active = $row_at['last_active'];
$last_active = strtotime("$last_active");
$time = ($now - $last_active);
$speed = $row_m['speed'];
$count = ($time/$speed);
$s=0;
$count = round($count);
while ($s <> $count) {
$s=$s+1;
$query_att = "Select id, hp, bronya, sost_cl, razriv_cl, sost_cl from users where location='$loca' and hp > 0 and last_active > NOW() - (60*5) and ban != 1 and m_fight = '$m_fight'";
$result_att = mysqli_query($dbc, $query_att) or die ('Ошибка передачи запроса к БД7');
$count_att = mysqli_num_rows($result_att);
$row_att = mysqli_fetch_array($result_att);
$t=1;
$rand_number = rand(1,$count_att);
while ($t<>$rand_number) {
$t=$t+1;
$row_att = mysqli_fetch_array($result_att);
}
///////////Жертва выбраnа
if ($row_att['sost_cl'] > 0) {
$bron = $row_att['razriv_cl'];
}
else {
$bron = 0;
}
$p = rand(245,275);
$p = ($p/1000);
if ($bron <> 0) {
$attack = (($row_m['yron'] / $bron) * $p);
}
else {
$attack = ($row_m['yron'] * $p);
}
$hp_att = ($row_att['hp'] - $attack);
if ($hp_att <= 0) {
if ($count_att <= 1) {
if ($row_m['clan'] <> 0) {
$query = "update m_fight set start = 0, hp='$max_hp_m' where id_fight='$m_fight' limit 1";
$result = mysqli_query($dbc, $query) or die ('Ошибка передачи запроса к БД4g');
}
$query = "update users set m_fight = 0 where m_fight='$m_fight' limit $max_people";
$result = mysqli_query($dbc, $query) or die ('Ошибка передачи запроса к БД4gt');
}
}
$id_att = $row_att['id'];
if ($id_att == $user_top) {
$hp=($hp_att);
$hp=round($hp);
}
$query_log = "insert into log (`time`, `user_id`, `sboitie`, `thing` , `yron`) values (NOW(), '$m_at', 10 , '$id_att', '$attack')";
$result_log = mysqli_query($dbc, $query_log) or die ('Ошибка передачи запроса к БД18');
if ($hp_att < 0) {
$query_log = "insert into log (`time`, `user_id`, `sboitie`, `thing` , `yron`) values (NOW(), '$m_at', 11 , '$id_att', '0')";
$result_log = mysqli_query($dbc, $query_log) or die ('Ошибка передачи запроса к БД18');
}
$query_reb = "update users set hp = '$hp_att' where id = '$id_att' limit 1";
$result_reb= mysqli_query($dbc, $query_reb) or die ('Ошибка передачи запроса к БД10');
if ($id_att == $user_id) {
$hphp=$hp_att;
}
$query_reb = "update m_fight set last_active=NOW() where id_fight = '$m_fight' limit 1";
$result_reb= mysqli_query($dbc, $query_reb) or die ('Ошибка передачи запроса к БД10');
}
////////////////////////////////////////////
////////////////////////////////////////////
}
}
}
///////////////////////////////////////////////////////////////////////// Конец нечести.
$last_active = $row_hp['last_active'];
$last_active = strtotime("$last_active");
///////////////////////////////Наставник
if (!empty($clan_ad)) {
$mentor_time = strtotime("$mentor_time");
$razn_mentor = ($now - $mentor_time);
if ($razn_mentor_user < 3600) {
$query_ment = "Select mentor from clans where clan_id = '$clan_ad'";
$result_ment = mysqli_query($dbc, $query_ment) or die ('Ошибка передачи запроса к БД');
$row_ment = mysqli_fetch_array($result_ment);
$mentor = $row_ment['mentor'];
if ($mentor_type == 1) {
$mentor = ($mentor/2);
}
$max_hp = ($max_hp+$max_hp/100*$mentor);
}
}
/////////////////////////////////////////
$hp_time = ($now - $last_active);
if ($hp > 0 ) {
$antirad_time = strtotime("$antirad_time");
$time = (date("Y-m-d H:i:s"));
$time = strtotime("$time");
$antirad_time = ($time - $antirad_time);
if ($location <> 'index' and $antirad_time > 7200) {
$query_loc = "select radiation from location where location_name = '$location' limit 1";
$result_loc = mysqli_query($dbc, $query_loc) or die ('Ошибка передачи запроса к БД2');
$row_loc = mysqli_fetch_array($result_loc);
$radiation_loc = $row_loc['radiation'];
$hp_down_rad = ($radiation - $radiation_loc);
if ($hp_down_rad < 0) {
$regen = ($regen + $hp_down_rad);
}
$showregen = abs($regen);
}
if ($hp_time !=0) {
$hp_up = ($hp_time * $regen);
$hp_up = ($hp + $hp_up);
if ($hp_up <= 0) {
$query_time_hp = "update users set hp = 0, last_active = NOW() where id = '$user_top' limit 1";
$result_time_hp = mysqli_query($dbc, $query_time_hp) or die ('Ошибка передачи запроса к БД');
$hp = 0;
}
if (($max_hp > $hp_up) and ($hp_up > 0)) {
$query_time_hp = "update users set hp = '$hp_up', last_active = NOW() where id = '$user_top' limit 1";
$result_time_hp = mysqli_query($dbc, $query_time_hp) or die ('Ошибка передачи запроса к БД');
}
if ($hp_up > $max_hp) {
$query_time_hp = "update users set hp = '$max_hp', last_active = NOW() where id = '$user_top' limit 1";
$result_time_hp = mysqli_query($dbc, $query_time_hp) or die ('Ошибка передачи запроса к БД');
}
}
else {
if ($hp<0) {
$hp=0;
}
}
}
else {
if ($hp<0) {
$hp=0;
}
}
$time_p = '--';
$speed_p = $row_hp['speed_p'];
$last_using_p = $row_hp['time_p'];
if ($speed_p <> 0) {
$last_using_p=strtotime("$last_using_p");
$timer_p = ($now - $last_using_p);
$time_p = ($speed_p - $timer_p);
if ($time_p <0) {
$time_p = 0;
}
}
////
$query_up_act = "update users set last_active = NOW() where id = '$user_top'";
$result_up_act = mysqli_query($dbc, $query_up_act) or die ('Ошибка передачи запроса к БД');
//////
$time_w = '--';
$speed_w = $row_hp['speed_w'];
$last_using_w = $row_hp['time_w'];
if ($speed_w <> 0) {
$last_using_w=strtotime("$last_using_w");
$timer_w = ($now - $last_using_w);
$time_w = ($speed_w - $timer_w);
if ($time_w <0) {
$time_w = 0;
}
}
?>
<div style="background-color:#000000;">
<div class="line">
<center>
<?php
if($row_hp[clan]<=0){
$pdo->exec("UPDATE users SET clanmes=0 WHERE id= '$user_top' LIMIT 1");}
if($row_hp[admin]<=0){
$pdo->exec("UPDATE users SET adm_chatmes=0 WHERE id= '$user_top' LIMIT 1");}
if ($mes <> 0 or $row_hp['message'] <> 0 or $row_hp['clanmes'] <> 0 or $row_hp['adm_chatmes'] <> 0 ) {?> <a style="text-decoration:none;" href="msg.php"></a><?php }else{?> <a style="text-decoration:none;" href="msg.php"> </a><?php }
?>
<img src="http://sdark.mobi/images/icon/stat/hp.png" alt="h" width="12" height="12"/><?php echo "$hp";?>
<img src='/img/sutost.png' height='12' /> <?php echo "$row_hp[sutost]";?>
<img src="http://sdark.mobi/images/icon/stat/sila.png" alt="p" width="12" height="12"/><?php echo "$time_p";?>
<img src="http://sdark.mobi/images/icon/stat/sila.png" alt="w" width="36" height="12"/><?php echo "$time_w";?>
<?php
if((time()-$row_hp['timearena']) < 1800) {
$time=$row_hp['timearena']-time()+1800;
echo '<span class="white">[<img src="/img/ico/time.png" />
'.($time/60%60).' мин. '.($time%60).' сек.]</span>';
}
if ($row_hp['sost_cl']<=0 and $row_hp['bronya'] <> 0) {
$show=1;
}
if ($row_hp['sost_p']<=0 and $row_hp['speed_p'] <> 0) {
$show=1;
}
if ($row_hp['sost_w']<=0 and $row_hp['speed_w'] <> 0) {
$show=1;
}
if ($show==1) {
?> <a href="clothes.php?id=<?php echo "$user_top"; ?>"><img src="img/ico/redshield.png" alt="w" width="12" height="12" border="0"/></a> <?php
}
////////////////////////////////////////////////Излучение
if ($location <> 'index' and $location <> 'yanov' and $location <> 'events' and $location <> 'forum' and $location <> 'anketa' and $location <> 'clanchat' and $location <> 'adminka' and $location <> 'adm_chat' and $location <> 'message' and $location <> 'baza_chn' and $location <> 'company' and $location <> 'online' and $location <> 'me' and $location <> 'mail' and $location <> 'gavaec' and $location <> 'setting' and $location <> 'rating' and $location <> 'chat' and $location <> 'forum' and $location <> 'clan' and $location <> 'news' and $location <> 'clan_chat') {
if ($regen > 0) {
?> <img src="img/ico/goodrad.png" alt="r" width="12" height="12"/>0<?php
}
if ($regen <= 0 and $regen > -10) {
?> <img src="img/ico/smrad.png" alt="r" width="12" height="12"/><?php echo "$showregen";
}
if ($regen < -10) {
?> <img src="img/ico/bigrad.png" alt="r" width="12" height="12"/><?php echo "$showregen";
}
}
///////////////////////////////////////////////////////////////////////
if ($row_hp['sms'] == 0 and $mes <> 0 or $row_hp['message'] <> 0 or $row_hp['clanmes'] <> 0 or $row_hp['adm_chatmes'] <> 0 ) {?> <a style="text-decoration:none;" href="msg.php"> <img src="img/ico/newletter.png" alt="смс" width="12" height="12"/><span class="gold">Новое сообщение</span></a><?php }
if ($speed_p == 0) {?></p></div>
<?php }?><?php
if ($user[radiation] == 0) {?></p></div>
<?php }?></center><br/><?php
echo'</div>';
if($row_hp['tainik_time'] > time() and $row_hp['tainik'] == 1)
{
$tainik_ostalos=$row_hp['tainik_time']-time();
echo '<br/><center><p><a class="white" style="text-decoration:none;" href="tainiki.php">Идет процесс взлома. Осталось
'.($tainik_ostalos).' сек., ждите.</a></br></center>';}
elseif($row_hp['tainik_time'] <= time() and $row_hp['tainik'] == 1)
{echo'<p><br/><center><a style="text-decoration:none;" href="tainiki.php"><span class="bonus">Тайник найден! Что же там было?</a></span></br></center>';}
if($row_hp['events'] > 0){echo'<br/><center><p><a style="text-decoration:none;" href="events.php"><span class="bonus">У вас есть новые события!</a></span></br></center>';}
$query_inv = "select user_id_in, clan_name, clan_id, id_in from in_clan where user_id = '$user_top'";
$result_inv = mysqli_query($dbc, $query_inv) or die ('Ошибка передачи запроса к БД');
$row_inv = mysqli_fetch_array($result_inv);
$user_id_in = $row_inv['user_id_in'];
$clan_name = $row_inv['clan_name'];
$clan_id = $row_inv['clan_id'];
$id_in = $row_inv['id_in'];
$count_inv = mysqli_num_rows($result_inv);
if ($count_inv <> 0) {
?>
<p class="zx"><span class="bonus"><img src="img/ico/point.png" width="12" height="12"/> <a href="profile.php?id=<?php echo "$id_in";?>"><?php echo "$user_id_in";?></a> приглашает вас вступить в
<?php
if ($gruppa_inv == 'svoboda') {?> <img src="img/ico/svobodaon.png" width="12" height="12"/><?php }
if ($gruppa_inv == 'dolg') {?> <img src="img/ico/dolgon.png" width="12" height="12"/><?php }
if ($gruppa_inv == 'naemniki') {?> <img src="img/ico/naemniki.png" width="12" height="12"/><?php }
if ($gruppa_inv == 'renegat') {?> <img src="img/ico/renegat.png" width="12" height="12"/><?php }
if ($gruppa_inv == 'chistoenebo') {?> <img src="img/ico/chistoenebo.png" width="12" height="12"/><?php }
?><a href="company.php?company_id=<?php echo "$clan_id";?>"><?php echo "$clan_name";?></a></span></p>
<p>[<a href="acceptinv.php?acc=1">Принять</a>][<a href="acceptinv.php?acc=2">Отклонить</a>]</p>
<?php
}
if (!empty($read_ad)) {
$query_ad = "select ad_nick, ad from clans where clan_id = '$clan_ad'";
$result_ad = mysqli_query($dbc, $query_ad) or die ('Ошибка передачи запроса к БД');
$row_ad = mysqli_fetch_array($result_ad);
$ad = $row_ad['ad'];
$ad_nick = $row_ad['ad_nick'];
?>
<p class="zx"><span class="white">Объявление отряда: </span><span class="bonus"><?php echo "$ad // $ad_nick"; ?></span> <span class="white">[<a class="white" href="hidead.php">скрыть</a>]</span></p>
<?php
}
include_once 'banned.php';
$day = 60*60*24;
$bonus_t = $row_hp['bonus_time'] + $day;
if(time()>$bonus_t){
echo '<br/><div class="r6"><center><a style="text-decoration:none;" href="bonus.php"><b>
<div style=color:#126478;font-size:15px;margin:12px;>Получить ежедневный бонус!</b></div></a></center></div>';
}
$tm = 60*5;
$bonus_t = $row_hp['game_reg'] + $tm;
if($bonus_t < time() and bar_game<15){
$dbc->query("UPDATE `users` SET `bar_game`=`bar_game`+1,`game_reg`=".time()." WHERE `id`='$reg'");
}
?>