Файл: tankon.mobi/tanks/cash.php
Строк: 235
<?
if(isset($_GET['zolota']) && in_array(intval($_GET['zolota']),array(1,5,10,25,50,100,500,1000)))
{
$zolota=intval($_GET['zolota']);
if($tanks_code['zolota']>=$zolota)
{
mysql_query("UPDATE `collective` SET `zolota` = '".($mc['zolota']+$zolota)."' WHERE `id` = '$mc[id]'");
$mc['zolota']=$mc['zolota']+$zolota;
mysql_query("INSERT INTO `collective_cash` SET `id_user` = '$tanks_code[id]', `id_collective` = '$mc[id]', `count` = '$zolota', `type` = 'zolota', `time` = '$time'");
mysql_query("UPDATE `collective_user` SET `rubies` = `rubies`+'".$zolota."' WHERE `id_user` = '$user[id]'");
mysql_query("UPDATE `tanks` SET `zolota` = '".($tanks_code['zolota']-$zolota)."' WHERE `id_u` = '$user[id]'");
$tanks_code['zolota']=$tanks_code['zolota']-$zolota;
header ("Location: /myclan?cash");
}
else {
err_game('Нехватает золота');
}
}
elseif(isset($_GET['serebro']) && in_array(intval($_GET['serebro']),array(1000,5000,10000,25000,50000,100000,500000,1000000)))
{
$serebro=intval($_GET['serebro']);
if($tanks_code['serebro']>=$serebro)
{
mysql_query("UPDATE `collective` SET `serebro` = '".($mc['serebro']+$serebro)."' WHERE `id` = '$mc[id]'");
$mc['serebro']=$mc['serebro']+$serebro;
mysql_query("INSERT INTO `collective_cash` SET `id_user` = '$tanks_code[id]', `id_collective` = '$mc[id]', `count` = '$serebro', `type` = 'serebro', `time` = '$time'");
mysql_query("UPDATE `tanks` SET `serebro` = '".($tanks_code['serebro']-$serebro)."' WHERE `id_u` = '$user[id]'");
mysql_query("UPDATE `collective_user` SET `money` = `money`+'".$serebro."' WHERE `id_user` = '$user[id]'");
$tanks_code['serebro']=$tanks_code['serebro']-$serebro;
header ("Location: /myclan?cash");
}
else {err_game('Нехватает серебра');
}
}
echo '<div class="trnt-block p5" style="margin-bottom:3px;">';
echo'<div class="medium white bold">
<img src="/tanks/images/icons/silver.png"> '.$mc['serebro'].'<br>
<img src="/tanks/images/icons/gold.png"> '.$mc['zolota'].'
</div></div>';
echo '<div class="bot"><table><tbody><tr>';
if(isset($_GET['zolots'])){
echo'<td class="w50 pr1"><a class="simple-but border" href="/myclan?cash&serebros"><span><span>+ Серебро</span></span></td>';
echo'<td class="w50 pr1"><a class="simple-but border red" href="/myclan?cash"><span><span>+ Золото</span></span></div></td>';
}elseif(isset($_GET['serebros'])){
echo'<td class="w50 pr1"><a class="simple-but border red" href="/myclan?cash"><span><span>+ Серебро</span></span></div></td>';
echo'<td class="w50 pr1"><a class="simple-but border " href="/myclan?cash&zolots"><span><span>+ Золото</span></span></a></td>';
}
else{
echo'<td class="w50 pr1"><a class="simple-but border" href="/myclan?cash&serebros"><span><span>+ Серебро</span></span></td>';
echo'<td class="w50 pr1"><a class="simple-but border " href="/myclan?cash&zolots"><span><span>+ Золото</span></span></a></td>';
}
echo'</tr></tbody></table></div>';
if(isset($_GET['zolots'])){
echo'<table>';
echo'<tr>';
echo'<td><a class="simple-but green" href="/myclan?cash&zolota=1"><span><span><img src="/tanks/images/icons/gold.png"> 1 золотую</span></span></a></td>';
echo'<td><a class="simple-but green" href="/myclan?cash&zolota=5"><span><span><img src="/tanks/images/icons/gold.png"> 5 золота</span></span></a></td>';
echo'</tr>';
echo'<tr>';
echo'<td><a class="simple-but green" href="/myclan?cash&zolota=10"><span><span><img src="/tanks/images/icons/gold.png"> 10 золота</span></span></a></td>';
echo'<td><a class="simple-but green" href="/myclan?cash&zolota=25"><span><span><img src="/tanks/images/icons/gold.png"> 25 золота</span></span></a></td>';
echo'</tr>';
echo'<tr>';
echo'<td><a class="simple-but green" href="/myclan?cash&zolota=50"><span><span><img src="/tanks/images/icons/gold.png"> 50 золота</span></span></a></td>';
echo'<td><a class="simple-but green" href="/myclan?cash&zolota=100"><span><span><img src="/tanks/images/icons/gold.png"> 100 золота</span></span></a></td>';
echo'</tr>';
echo'<tr>';
echo'<td><a class="simple-but green" href="/myclan?cash&zolota=500"><span><span><img src="/tanks/images/icons/gold.png"> 500 золота</span></span></a></td>';
echo'<td><a class="simple-but green" href="/myclan?cash&zolota=1000"><span><span><img src="/tanks/images/icons/gold.png"> 1k золота</span></span></a></td>';
echo'</tr>';
echo'</table>';
}
elseif(isset($_GET['serebros'])){
echo'<table>';
echo'<tr>';
echo'<td><a class="simple-but green" href="/myclan?cash&serebro=1000"><span><span><img src="/tanks/images/icons/silver.png"> 1к серебра</span></span></a></td>';
echo'<td><a class="simple-but green" href="/myclan?cash&serebro=5000"><span><span><img src="/tanks/images/icons/silver.png"> 5к серебра</span></span></a></td>';
echo'</tr>';
echo'<tr>';
echo'<td><a class="simple-but green" href="/myclan?cash&serebro=10000"><span><span><img src="/tanks/images/icons/silver.png"> 10к серебра</span></span></a></td>';
echo'<td><a class="simple-but green" href="/myclan?cash&serebro=25000"><span><span><img src="/tanks/images/icons/silver.png"> 25к серебра</span></span></a></td>';
echo'</tr>';
echo'<tr>';
echo'<td><a class="simple-but green" href="/myclan?cash&serebro=50000"><span><span><img src="/tanks/images/icons/silver.png"> 50к серебра</span></span></a></td>';
echo'<td><a class="simple-but green" href="/myclan?cash&serebro=100000"><span><span><img src="/tanks/images/icons/silver.png"> 100к серебра</span></span></a></td>';
echo'</tr>';
echo'<tr>';
echo'<td><a class="simple-but green" href="/myclan?cash&serebro=500000"><span><span><img src="/tanks/images/icons/silver.png"> 500к серебра</span></span></a></td>';
echo'<td><a class="simple-but green" href="/myclan?cash&serebro=1000000"><span><span><img src="/tanks/images/icons/silver.png"> 1m серебра</span></span></a></td>';
echo'</tr>';
echo'</table>';
}
$k_post = mysql_result(mysql_query("SELECT COUNT(*) FROM `collective_user` WHERE `id_collective` = '".$mc['id']."'"),0);
$k_page=k_page($k_post,$set['p_str']);
$page=page($k_page);
$start=$set['p_str']*$page-$set['p_str'];
$num=($page-1)*$set['p_str'];
$q=mysql_query("SELECT * FROM `collective_user` WHERE `id_collective` = '".$mc['id']."' ORDER BY `rubies` DESC LIMIT $start, 7");
echo '<div class="trnt-block p5" style="margin-bottom:3px;">';
while($post=mysql_fetch_array($q))
{
$num++;
$uk=mysql_fetch_array(mysql_query("SELECT * FROM `user` WHERE `id` = '$post[id_user]'"));
$tankss_codes=mysql_fetch_array(mysql_query("SELECT * FROM `tanks` WHERE `id_u` = '$uk[id]'"));
$uuk=$uk;
echo''.anscs($uk['id']).'';
echo" <span class='white small bold'><img src='/tanks/images/icons/gold.png'> ".rating($post['rubies'])."
<img src='/tanks/images/icons/silver.png'> ".rating($post['money'])."</span><br>";
}
echo'</div>';
if ($k_page>1){str("/myclan?cash&",$k_page,$page);}else{} // Вывод страниц
echo'<a class="simple-but gray mb10" href="/myclan"><span><span>Назад</span></span></a></div>';
include_once 'foots.php';
exit;
?>