Просмотр файла sdark.mobi/index.php

Размер файла: 14.18Kb
<?php
require_once 'core/system.php';
$header = 'Сила Тьмы';
require_once H.'core/head.php';
if(isset($user['id'])){
if($user['mesto']!='Главная') mysql_query("UPDATE `user` set `mesto` = 'Главная' where `id` = '".$user['id']."'");
	
$req = mysql_query("SELECT `ban` from `ban` where `id_us` = '".$user['id']."'  and `time` > '".$_SERVER['REQUEST_TIME']."'");
$ban = mysql_fetch_array($req);
if($ban['ban'] == 3){
	header('Location: /moduls/ban');
}
	
if(empty($user['plem'])){
header('Location: /start/step-2.php?act=plem&pol='.$user['pol'].'');
$_SESSION['err'] = 'Введите данные';
exit();
}

if($user['save'] == 0){
header('Location: /start/step-3');
exit();
}

if($user['level'] > 9 and $user['bonus'] <= time()){
header("Location: welcome");
}

$rqb = mysql_query("SELECT `usr`,`who` FROM `duel` WHERE (`usr`  = '".$user['id']."' or `who`  = '".$user['id']."') and `status`=''");
$zaydav = mysql_fetch_array($rqb);
$ya = mysql_num_rows($rqb);

if($ya > 0){
$rem = mysql_query("SELECT `id` FROM `duel_bat` WHERE (`usr`='".$zaydav['usr']."' and `who`='".$zaydav['who']."')  and `status`=''");
$hjk = mysql_num_rows($rem);
if($hjk > 0){
	header('Location: /duel/fight'); 
exit;
}
}

$colis = mysql_query("SELECT `timer` FROM `coliseum` WHERE `usr` = '".$user['id']."' and `status`='1' and `fight`=''");
$coli = mysql_fetch_array($colis);
$coll = mysql_num_rows($colis);
$do = $coli['timer']-$_SERVER['REQUEST_TIME'];
if($coll > 0 and $do < 0){
	header('Location: /coliseum/fight');
 exit;
}

mysql_query("UPDATE `user` set  `battle` = '0', `hexp`='0' where `id` = '".$user['id']."' ");
mysql_query("UPDATE `def_bat` set  `fight` = '0' where `usr` = '".$user['id']."' ");
mysql_query("DELETE FROM `hik_us` WHERE `usr`='".$user['id']."'");
//mysql_query("DELETE FROM `logi` WHERE `time`<".(time()-1209600)."");

mysql_query("DELETE FROM `duellog` WHERE `timer`<='".time()."' ");
mysql_query("DELETE FROM `battle` WHERE `time`<='".time()."' ");
mysql_query("DELETE FROM `link` WHERE `timer`<'".time()."'");
mysql_query("UPDATE `hunting` SET `status`='1', `fight`='".rand(0,1)."',`close`='0' ,`battle`='0' ,`win`='0' WHERE `time`<'".$time."' and `status`='0'");
  
$bat = mysql_result(mysql_query("SELECT COUNT(id) FROM `battle` WHERE `usr` = '".$user['nick']."'"),0);
if($bat > 0){
	mysql_query("UPDATE `battle` SET `status` = 'no' WHERE `usr`='".$user['nick']."'");
}
	
$cap = mysql_result(mysql_query("SELECT COUNT(id) FROM `capture` WHERE `usr` = '".$user['id']."'"),0);
if($cap > 0){
	mysql_query("DELETE FROM `capture` WHERE `usr`='".$user['id']."'");
}

$ruq = mysql_query("SELECT `level`,`win` from `hunting` where `usr` = '".$user['id']."' and `battle`='1' and `status`='1'");
$hnt = mysql_fetch_array($ruq);
$hnta = mysql_num_rows($ruq);
if($hnta > 0){
if($hnt['win']==0){
 $kolvo=0;
 $kolvo2 = floor((rand(1,$hnt['level'])*$exp)/400);
 if($setgame['exp']==1) $kolvo2=$kolvo2*2;
 $kolvoo = $kolvo*100;

mysql_query("UPDATE `user` SET `gold` = `gold`+'".$kolvoo."',`exp` = `exp`+'".$kolvo2."' WHERE `id` = '".$user['id']."'");
mysql_query("UPDATE `hunting` SET `status` = '2', `win`='2',`gold`=`gold`+'".$kolvoo."', `exp`=`exp`+'".$kolvo2."'  WHERE `usr` = '".$user['id']."'");
if($kolvo > 99){
	$gold='gold';
}
if($kolvo < 100){
	$gold='silver';
}
$_SESSION['light']="<font color='orange'> Охота успешно завершена!</font></br> <span class='blue'>Получено:  <img src='/images/icon/exp.png' alt=''/>".$kolvo2." <img src='/images/icon/".$gold.".png' alt=''/>".$kolvo." </span> ";
header("Location: /hunting/"); 

} else {
	
 $kolvo = rand(0,$hnt['level']);
 $kolvo2 = floor((rand(1,$hnt['level'])*$exp)/100);
 if($setgame['exp']==1) $kolvo2=$kolvo2*2;
 $kolvoo=$kolvo*100;
//,`snow`=`snow`+'1'
mysql_query("UPDATE `user` SET `gold` = `gold`+'".$kolvoo."',`exp` = `exp`+'".$kolvo2."' WHERE `id` = '".$user['id']."'");//,`snow`=`snow`+'1'
mysql_query("UPDATE `hunting` SET `status` = '2', `gold`=`gold`+'".$kolvoo."', `exp`=`exp`+'".$kolvo2."'  WHERE `usr` = '".$user['id']."'");
if($kolvoo > 99){
	$gold='gold';
}
if($kolvoo < 100){
	$gold='silver';
}
$_SESSION['light']="<font color='orange'> Охота успешно завершена!</font></br> <span class='blue'>Получено:  <img src='/images/icon/exp.png' alt=''/>".$kolvo2." <img src='/images/icon/".$gold.".png' alt=''/>".$kolvo." ";// <img src='/images/icon/dost.png'>1
header("Location: /hunting/"); 
}
}

$req = mysql_query("SELECT `id`,`fight` FROM `hiking` where (`lider`='".$user['id']."' || `usr1`='".$user['id']."' || `usr2`='".$user['id']."' || `usr3`='".$user['id']."')");
$hik = mysql_fetch_array($req);
$hik_us = mysql_result(mysql_query("SELECT COUNT(`id`) FROM `hik_us` WHERE `hik`='".$hik['id']."'"),0);
if($hik_us==0 && $hik['fight']==1){
	mysql_query("UPDATE `hiking` set `fight` = '' where `id` = '".$hik['id']."'");
}

if($user['health'] < 1){
$hhhe=$user['max_health']/2;
mysql_query("UPDATE `user` set `health` = '".$hhhe."' where `id` = '".$user['id']."'");
header("Location: /moduls/recovery");
}

if(isset($_GET['restore']) and $user['gold'] > 10){

if($user['max_health']==$user['health']){
$_SESSION['err'] = ' Ошибка';
header("Location: /"); 
}

$rest = mysql_result(mysql_query("SELECT COUNT(id) FROM `logi` WHERE `user_id` = '".$user['id']."' and `text` = 'Восстановление'"),0);
if($rest==0){
mysql_query("INSERT INTO `logi` set `user_id` = '".$user['id']."', `text` = 'Восстановление', `time` = '".$_SERVER['REQUEST_TIME']."', `kol`='10', `kto`='-'");
} else {
mysql_query("UPDATE `logi` set `user_id` = '".$user['id']."', `time` = '".$_SERVER['REQUEST_TIME']."', `kol`=`kol`+'10', `kto`='-' WHERE `user_id` = '".$user['id']."' and `text` = 'Восстановление'");
}
mysql_query("UPDATE `user` set `health` = '".$user['max_health']."', `gold`=`gold`-'10' where `id` = '".$user['id']."'");
header("Location: /moduls/recovery");
}
?>
</div>
</div>
<div class='line'></div>
<div class='temn'><center>
<div class='player title'>
<font size='4'>Сила Тьмы</font> 
</div>
<div class='line'></div>
<?php

$demi = mysql_fetch_assoc(mysql_query("SELECT * from `attack` where `id` = '1'"));
if($att > 0 && $demi['status'] == 0){
echo"<img src='/attack/attack.png' width='100%'></div>";
} else {
echo"<img src='/images/main.jpg' width='100%'></div>";
}
?>
</center>
<hr>
<?
if($user['health'] < $user['max_health']){
	echo'<px><div class="but-list-light center">
	<a href="?restore"><img src="/images/icon/ok.png"> Восстановить здоровье <img src="/images/icon/silver.png">10</a>
	</div>
	<hr>';
	}
	
if($att > 0 && $demi['status'] == 0){
	echo'<px><div class="foot">
	<a class="mini-fight center" href="/attack/"><img src="/images/icon/fight.png"> В бой </a>
	</div>
	<hr>';
	}
?>
<table  class="foot" width="100%" border="0" cellpadding="0" cellspacing="0" style="padding-top: 5px;">
<tbody>
<tr>

<td width="33%">
<a class="big-but" href="/capture/">
<div class="imgwrap"><img src="/images/main/capture.png"></div></div>
<span>Захват</span></a></div>
</td>
	
<td width="33%">
<a class="big-but" href="/task/normal">
<div class="imgwrap"><img src="/images/main/task.png" ></div></div><span>Задания</span></a>
</td>


<?
if($user['level'] < 7 ){	
echo'<td width="33%">
<a class="big-but" href="/survival/">
<div class="imgwrap"><img src="/images/main/survival-grey.png"></div><span>Выживания</span></a>
</td>
</tr>';	
} else {
echo'<td width="33%" >
<a class="big-but" href="/survival/">
<div class="imgwrap"><img src="/images/main/survival.png"></div><span>Выживания</span></a>
</td>
</tr>';
}


if($user['level'] < 15 ){
echo'<td width="33%">
<a class="big-but" href="/defense/">
<div class="imgwrap"><img src="/images/main/defense-grey.png"></div><span>Оборона</span></a>
</td>';	
} else {	
echo'<td width="33%">
<a class="big-but" href="/defense/">
<div class="imgwrap"><img src="/images/main/defense.png"></div><span>Оборона</span></a>
</td >';
}



if($user['level'] < 30){
echo'<td width="33%">
<a class="big-but" href="/coliseum/">
<div class="imgwrap"><img src="/images/main/coliseum-grey.png"></div><span>Колизей</span></a>
</td>';	
} else {	
echo'<td width="33%">
<a class="big-but" href="/coliseum/">
<div class="imgwrap"><img src="/images/main/coliseum.png"></div><span>Колизей</span></a>
</td>';
}


if($user['level'] < 15){
echo'<td width="33%">
<a class="big-but" href="/hunting/">
<div class="imgwrap"><img src="/images/main/hunting-grey.png"></div><span>Охота</span></a>
</td>
<tr>';	

} else {	
echo'<td width="33%">
<a class="big-but" href="/hunting/">
<div class="imgwrap"><img src="/images/main/hunting.png"></div><span>Охота</span></a>
</td>
<tr>';
}


if($user['level'] < 10){
echo'<td width="33%">
<a class="big-but" href="/hiking/">
<div class="imgwrap"><img src="/images/main/hiking-grey.png"></div><span>Поход</span></a>
</td>';

} else {
echo'<td width="33%">
<a class="big-but" href="/hiking/">
<div class="imgwrap"><img src="/images/main/hiking.png"></div><span>Поход</span></a>
</td>';
}


 if($user['level'] < 10){
	 
echo'<td width="33%">
<a class="big-but" href="/duel/">
<div class="imgwrap"><img src="/images/main/duel-grey.png"></div><span>Дуэли</span></a>
</td>';
} else {
	
echo'<td width="33%">
<a class="big-but" href="/duel/">
<div class="imgwrap"><img src="/images/main/duel.png"></div><span>Дуэли</span></a>
</td>';
}




if($user['level'] < 10){
echo'<td width="33%">
<a class="big-but" href="/tournament/">
<div class="imgwrap"><img src="/images/main/tournament-grey.png"></div><span>Турнир</span></a>
</td>
<tr>';	

} else {	
echo'<td width="33%">
<a class="big-but" href="/tournament/">
<div class="imgwrap"><img src="/images/main/tournament.png"></div><span>Турнир</span></a>
</td>
<tr>';
} 
echo'</tr>
</table>
<table class="foot" width="100%" border="0" cellpadding="0" cellspacing="0" style="padding-top: 5px;">';

	
echo'<td width="33%">
<a class="big-but" href="/old_man/">
<div class="imgwrap"><img src="/images/main/old-man.png"></div><span>Старик</span></a>
</td>';


if($user['level'] < 40){
	
echo'<td width="33%">
<a class="big-but" href="/labyrinth/">
<div class="imgwrap"><img src="/images/main/labyrinth-grey.png"></div><span>Лабиринт</span></a>
</td>';

} else {
	
echo'<td width="33%">
<a class="big-but" href="/labyrinth/">
<div class="imgwrap"><img src="/images/main/labyrinth.png"></div><span>Лабиринт</span></a>
</td>';
}

if($user['level'] < 20){
echo'<td width="33%">
<a class="big-but" href="/temple/">
<div class="imgwrap"><img src="/images/main/temple-grey.png"></div><span>Храм</span></a>
</td>
<tr>';

} else {
echo'<td width="33%">
<a class="big-but" href="/temple/">
<div class="imgwrap"><img src="/images/main/temple.png"></div><span>Храм</span></a>
</td>
<tr>';
}

if($user['level'] < 10){
	
echo'<td width="33%">
<a class="big-but" href="/smith/">
<div class="imgwrap"><img src="/images/main/smith-grey.png"></div><span>Кузнец</span></a>
</td>';

} else {
	
echo'<td width="33%">
<a class="big-but" href="/smith/">
<div class="imgwrap"><img src="/images/main/smith.png"></div><span>Кузнец</span></a>
</td>';
}


if($user['level'] < 7){
echo'<td width="33%">
<a class="big-but" href="/master/">
<div class="imgwrap"><img src="/images/main/master-grey.png"></div><span>Мастер</span></a>
</td>';	
} else {	
echo'<td width="33%">
<a class="big-but" href="/master/">
<div class="imgwrap"><img src="/images/main/master.png"></div><span>Мастер</span></a>
</td>';
}

if($user['level'] < 5){
echo'<td width="33%">
<a class="big-but" href="/shaman/">
<div class="imgwrap"><img src="/images/main/shaman-grey.png"></div><span>Шаман</span></a>
</td>
<tr>';

} else {
echo'<td width="33%">
<a class="big-but" href="/shaman/">
<div class="imgwrap"><img src="/images/main/shaman.png"></div><span>Шаман</span></a>
</td>
<tr>';
}
?>
<td width="33%">
<a class="big-but" href="/shop/">
<div class="imgwrap"><img src="/images/main/shop.png"></div><span>Магазин</span></a>
</td>

<td width="33%">
<a class="big-but" href="/top/bonecrusher"><div class="imgwrap"><img src="/images/main/rating.png"></div><span>Подвиги</span></a>
</td>

<td width="33%">
<a class="big-but" href="/clan/rating"><div class="imgwrap"><img src="/images/main/clan.png"></div><span>Кланы</span>
</a>
</td>


</tbody>
</table>
</div></div>
<?

} else {
	
?>

<hr>
<div class='temn'>
<center>
<div class='foot grey'>
<font size='2'>«Сила Тьмы» - мобильная онлайн игра</font> 
</div>
</div>
<div class='line'></div>
<img src='/images/start/start.png' width='100%' style='border:-12px solid #131313;' alt='start'>
<div class='line'></div>
<center>
<div class='player'>
<div class='empty'></div>
<font color='ACACAC'> Тьма поглощает мир... Вступи в бой и сразись с темной силой!</font>
<div class='empty'></div>
<?
if(isset($_GET['ref']) > 0){
	
$inv = mysql_fetch_array(mysql_query("SELECT `id`,`nick` from `user` where `id` = '".abs(intval($_GET['ref']))."'"));
echo'<form class="" method="post" action="/start/step-1?ref='.$inv['id'].'">
<input type="submit" class="start-login"  value="Начать Игру"/>
</form>
<div class="empty"></div>
<div class="empty"></div>';

} else {
echo'<form class="" method="post" action="/start/step-1" >
<input type="submit" class="start-login"  value="Начать Игру"/>
</form>
<div class="empty"></div>
<div class="empty"></div>';
}

if($_SESSION['pumpit_id']==0 AND $_SESSION['fs_key']==0 AND $_SESSION['ok_id']==0 AND $_SESSION['m_id']==0){
echo"<font color='979797'>Уже есть персонаж?</font>";

echo '<form method="post" action="/auth.php?act=post" >
<div class="empty2"></div>
<input class="text medium-text" type="text" name="nick" /><br />
<input class="text medium-text" type="password" name="pass" />
<div class="empty"></div>

<align=left><input type="submit" class="ent-login"  value="Войти"/>
<div class="empty2"></div>
<a href="/general/newpass">Забыли пароль?</a> 
<div class="empty2"></div>
</form>
<div class="empty2"></div>';
}

echo '<div class="grey">
Всего зарегистрировано <font color="EEF1F4">'.mysql_result(mysql_query("SELECT count(`id`) from `user`"),0).'</font> персонажей 
<div class="empty2"></div>
</div>
</div>
</div>';

}

require_once H.'core/foot.php';
?>