Файл: tankon.mobi/tanks/avatars.php
Строк: 90
<?
include_once '../sys/inc/start.php';
include_once '../sys/inc/compress.php';
include_once '../sys/inc/sess.php';
include_once '../sys/inc/home.php';
include_once '../sys/inc/settings.php';
include_once '../sys/inc/db_connect.php';
include_once '../sys/inc/ipua.php';
include_once '../sys/inc/fnc.php';
include_once '../sys/inc/user.php';
include_once '../sys/inc/thead.php';
title();aut();
echo '<link rel="stylesheet" href="style.css" type="text/css" />';
include_once 'function.php';
echo'<table><tr>
<td style="width:50%;padding:0 2px;">
<div style="position:relative;">
<div class="simple-but mb5 blue" w:id="selectGermany" href="/"><span><span>Аватар</span></span></div>
</div>
</td>
<td style="width:50%;padding-right:2px;">
<div style="position:relative;">
<a class="simple-but mb5 gray" w:id="selectUssr" href="/avafoto"><span><span>Фото</span></span></a>
</div>
</td>
</tr></table>
';
if(isset($_GET['ok'])){
$sclad = mysql_fetch_assoc(mysql_query("SELECT * FROM `tanks_ava` WHERE `id`='".abs(intval($_GET['ok']))."'"));
if(mysql_result(mysql_query("SELECT COUNT(*) FROM `tanks_ava` WHERE `id` = '".intval($_GET['ok'])."'"), 0)!=0){
if($tanks_code['ava']!=$sclad['id']) {
if($tanks_code['zolota'] >= $sclad['price']) {
mysql_query("UPDATE `tanks` SET `ava`='".$sclad['id']."' WHERE `id_u`='".$user['id']."'");
mysql_query("UPDATE `tanks` SET `zolota`=`zolota`-'$sclad[price]' WHERE `id_u`='".$user['id']."'");
header("Location:/avatars?yes");
}else {err_game('У вас недостаточно золота');}
}else {err_game('У вас установлен этот аватар');}
}else {err_game('Нет такого аватара');}
}
if(isset($_GET['yes'])){
err_sms('Аватар установлен');
}
$shop = mysql_query("SELECT * FROM `tanks_ava`");
echo '<div class="trnt-block mb5">
<div class="wrap-content"><table>';
while($shops = mysql_fetch_array($shop)) {
if ($shops['id']=='1'){echo'<tr>';}
if ($shops['id']=='3'){echo'<tr>';}
if ($shops['id']=='5'){echo'<tr>';}
if ($shops['id']=='7'){echo'<tr>';}
if ($shops['id']=='9'){echo'<tr>';}
if ($shops['id']=='11'){echo'<tr>';}
if ($shops['id']=='13'){echo'<tr>';}
if ($shops['id']=='15'){echo'<tr>';}
if ($shops['id']=='17'){echo'<tr>';}
echo'<td><div class="thumb m0a"><img alt="avatar" src="/images/avatar/'.$shops['screen'].'"/><span class="mask2"> </span></div>
';
if ($shops['id']!=$tanks_code['ava']){
echo'<center><a class="simple-but w50 cntr mb5" href="?ok='.$shops['id'].'"><span><span>Купить</span></span></a>';
} else {
echo'<center><div class="simple-but w50 cntr mb5 gray"><span><span>Выбран</span></span></div>';
}
echo'
<div class="small bold sh_b gray1 mt5 cntr">Цена
<img class="ico vm" src="tanks/images/icons/gold.png" alt="Золото" title="Золото"> '.$shops['price'].'</div></center>';
echo'</td>';
if ($shops['id']=='2'){echo'</tr>';}
if ($shops['id']=='4'){echo'</tr>';}
if ($shops['id']=='6'){echo'</tr>';}
if ($shops['id']=='8'){echo'</tr>';}
if ($shops['id']=='10'){echo'</tr>';}
if ($shops['id']=='12'){echo'</tr>';}
if ($shops['id']=='14'){echo'</tr>';}
if ($shops['id']=='16'){echo'</tr>';}
if ($shops['id']=='18'){echo'</tr>';}
}
echo'</table></div></div></div>';
include_once 'foots.php';
?>