View file sdark.mobi/old_man/index.php

File size: 6.52Kb
<?
require_once'../core/system.php';
echo only_reg();
echo ban();
echo blok();
$header='Старик';
require_once'../core/head.php';
mysql_query("UPDATE `user` set `mesto` = 'Старик', `battle` = '0' where `id` = '".$user['id']."'");

echo"<img src='/images/old-man.jpg' width='100%'><hr>";
if(!isset($_GET['rate']) and !isset($_GET['result'])){
echo'<div class="foot grey center">Не желаете ли сыграть в наперстки и выиграть золото?</div>';

 echo"<hr><div class='foot center'>Выберите ставку</br><div class='empty2'></div>
 <table  class='foot' width='100%' border='0' cellpadding='1px' cellspacing='0' style='padding-top: 5px;'>
<tbody>
<tr>
<td width='16%'> <a class='big-but' href='?rate=1'><div class='imgwrap'><img src='/images/icon/gold.png'></div>1</a></td>
<td width='16%'> <a class='big-but' href='?rate=5'><div class='imgwrap'><img src='/images/icon/gold.png'></div>5</a></td>
<td width='16%'> <a class='big-but' href='?rate=10'><div class='imgwrap'><img src='/images/icon/gold.png'></div>10</a></td>
<td width='16%'> <a class='big-but' href='?rate=25'><div class='imgwrap'><img src='/images/icon/gold.png'></div>25</a></td>
<td width='16%'> <a class='big-but' href='?rate=100'><div class='imgwrap'><img src='/images/icon/gold.png'></div>100</a></td>
<td width='16%'> <a class='big-but' href='?rate=250'><div class='imgwrap'><img src='/images/icon/gold.png'></div>250</a></td></td></tbody></table>
</div></div>";
	}
if(isset($_GET['rate']) and !isset($_GET['result'])){
$rate = intval($_GET['rate']);
$rago=$rate*100;
if($user['gold']<$rago){
header("Location: /old_man/");
$_SESSION['err'] = 'Недостаточно золота';
exit;
}

if($rate==1 or $rate==5 or $rate==10 or $rate==25 or $rate==100 or $rate==250){
echo'<div class="main grey center"><div class="empty2"></div>Интересно... Повезёт ли Вам? Выберите один из 3 наперстков!<div class="empty2"></div></div>';

	
echo'<hr><div class="head grey center">
<table  class="head" width="100%" border="0" cellpadding="0" cellspacing="0" style="padding-top: 5px;">
<tbody>
<tr>
<td width="33%"><a href="?rate='.$rate.'&thimble=1"><div class="imgwrap"><img src="/images/thimble.png"></div></a></td>
<td width="33%"><a href="?rate='.$rate.'&thimble=2"><div class="imgwrap"><img src="/images/thimble.png"></div></a></td>
<td width="33%"><a href="?rate='.$rate.'&thimble=3"><div class="imgwrap"><img src="/images/thimble.png"></div></a></td>
</tbody></table></div>';
} else { 
$_SESSION['err'] = "Ошибка";
header('Location: /old_man/');
exit();
}
}
if(isset($_GET['rate'],$_GET['thimble']) and !isset($_GET['result'])){
$rate = intval($_GET['rate']);
$thimble = intval($_GET['thimble']);

$rago=$rate*100;
if($user['gold']<$rago){
header("Location: /old_man/");
$_SESSION['err'] = 'Недостаточно золота';
exit;
}

if($thimble>3 or $thimble<1){
$_SESSION['err'] = "Ошибка";
header('Location: /old_man/');
exit();
}
if($rate==1 or $rate==5 or $rate==10 or $rate==25 or $rate==100 or $rate==250){
$fedja = rand(1,3);
$lol = rand(1,3);
if($lol>2 && $fedja==1 && $thimble==1){$fedja=2;}
if($lol>2 && $fedja==2 && $thimble==2){$fedja=1;}
if($lol>2 && $fedja==3 && $thimble==3){$fedja=2;}
if($fedja==$thimble){
	
$rest = mysql_result(mysql_query("SELECT COUNT(*) FROM `logi` WHERE `user_id` = '".$user['id']."' and `text` = 'Старик' and `kto`='+'"),0);
if($rest==0){
mysql_query("INSERT INTO `logi` set `user_id` = '".$user['id']."', `text` = 'Старик', `time` = '".$time."', `kol`='".($rago*3)."', `kto`='+'");
} else {
mysql_query("UPDATE `logi` set `time` = '".$tm."', `kol`=`kol`+'".($rago*3)."', `kto`='+' WHERE `user_id` = '".$user['id']."' and `text` = 'Старик'  and `kto`='+'");
}	
mysql_query("UPDATE `user` SET `gold`=`gold`+'".($rago*3)."'  WHERE `id`='".$user['id']."'");
	
$_SESSION['light'] = "<font color='#FE642E'>Вы угадали!</font>
<div class='empty'></div><span class='blue'>Ваша награда:</span> <img src='/images/icon/gold.png' alt=''/> ".($rate*3)." </div>";
} else {
$rest = mysql_result(mysql_query("SELECT COUNT(*) FROM `logi` WHERE `user_id` = '".$user['id']."' and `text` = 'Старик' and `kto`='-'"),0);
if($rest==0){
mysql_query("INSERT INTO `logi` set `user_id` = '".$user['id']."', `text` = 'Старик', `time` = '".$time."', `kol`='".$rago."', `kto`='-'");
} else {
mysql_query("UPDATE `logi` set `time` = '".$tm."', `kol`=`kol`+'".$rago."', `kto`='-' WHERE `user_id` = '".$user['id']."' and `text` = 'Старик'  and `kto`='-'");
}	
mysql_query("UPDATE `user` SET `gold`=`gold`-'".$rago."'  WHERE `id`='".$user['id']."'");
$_SESSION['light'] = "<font color='#FE642E'>Вы проиграли, попытайтесь ещё раз!</font>";
}

header("Location: /old_man/?rate=".$rate."&thimble=".$thimble."&result=".$fedja.""); 
} else { 
$_SESSION['err'] = "Ошибка";
header('Location: /old_man/');
exit();
}
}
if(isset($_GET['result'])){
	
echo'<div class="head grey center">
<table  class="head" width="100%" border="0" cellpadding="0" cellspacing="0" style="padding-top: 5px;">
<tbody>
<tr>';
$result = intval($_GET['result']);
$thimble = intval($_GET['thimble']);
if($result==1 && $thimble==1){
echo'<td width="33%"><div class="imgwrap"><img src="/images/thimble-yes.png"></div></td>';
}elseif($thimble==1 && $result!=1){
echo'<td width="33%"><div class="imgwrap"><img src="/images/thimble-no.png"></div></td>';
} else {
	echo'<td width="33%"><div class="imgwrap"><img src="/images/thimble.png"></div></td>';
} 

if($result==2 && $thimble==2){
echo'<td width="33%"><div class="imgwrap"><img src="/images/thimble-yes.png"></div></td>';
}elseif($thimble==2 && $result!=2){
echo'<td width="33%"><div class="imgwrap"><img src="/images/thimble-no.png"></div></td>';
} else {
	echo'<td width="33%"><div class="imgwrap"><img src="/images/thimble.png"></div></td>';
}

if($result==3 && $thimble==3){
echo'<td width="33%"><div class="imgwrap"><img src="/images/thimble-yes.png"></div></td>';
}elseif($thimble==3 && $result!=3){
echo'<td width="33%"><div class="imgwrap"><img src="/images/thimble-no.png"></div></td>';
} else {
	echo'<td width="33%"><div class="imgwrap"><img src="/images/thimble.png"></div></td>';
}
echo'</tbody></table></div>';
	
	echo'<hr>
	<div class="head">
	<a class="mini-fight" href="?">Сыграть ещё раз</a>
	</div>';
}
	
?>
<hr><div class="player"><div class="empty"></div><div class="center grey">Если угадаете, Вы получите в 3 раза больше золота!</div><div class="empty"></div></div>
<?
require_once'../core/foot.php';
?>