Deefy, [code]if(isset($_GET['deck']) and !empty($_GET['deck'])){
$deck = int($_GET['deck']);
$test_in_fight = mysql_result(mysql_query("SELECT COUNT(id) FROM `fights` WHERE `us1`='".$user['id']."'"

,0);
if($test_in_fight>0){
header("Location: play.php"

;
exit;
}
#if()
if($deck>3){
header("Location: index.php"

;
exit;
}
require_once 'head.php';
echo '<div class="header"><div class="title">Колода</div>';
echo '<div class="white_row-Option t_center w280" style="margin-top: 5px;">';
$cards = mysql_query("SELECT * FROM `user_cards`
WHERE `card_id`!='".$user['card1']."'
AND `card_id`!='".$user['card2']."'
AND `card_id`!='".$user['card3']."'
AND `user_id`='".$user['id']."'"

;
$count = mysql_num_rows($cards);
if($deck==1) : echo '<div class="card'.$user['card1'].'"></div><br>Заменить на <br>'; endif;
if($deck==2) : echo '<div class="card'.$user['card2'].'"></div><br>Заменить на <br>'; endif;
if($deck==3) : echo '<div class="card'.$user['card3'].'"></div><br>Заменить на <br>'; endif;
if($count>0){
while($card_change=mysql_fetch_assoc($cards)){
echo '<a href="?deck_c='.$card_change['card_id'].'&deck='.$deck.'"><div class="card'.$card_change['card_id'].'" style="margin:2px;height:70px;width: 57px;"></div></a>';
}
}else{
echo 'У вас нет доступных карт на смену';
}
echo '</div>';
echo '</div></body></html>';
exit;
}
/* УРОВЕНь => ЦЕНА Увеличение уровня карты*/
if(isset($_GET['upgrade']) and !empty($_GET['upgrade'])){
$upgrade = int($_GET['upgrade']);
$up = mysql_fetch_assoc(mysql_query("SELECT *
FROM `user_cards`
WHERE `id`='".$upgrade."' LIMIT 1"

);
if($up['user_id'] != $user['id'] OR $up['card_lvl']>$max_lvl){
header("Location: index.php"

;
exit;
}
elseif($up['total_cards']<$card_level[$up['card_lvl']]){
require_once 'head.php';
echo '<div id="error">Недостаточно карт</div>';
require_once 'bot.php';
echo '</body></html>';
exit;
}
elseif($user['gold']<$price_card_level[$up['card_lvl']]){
require_once 'head.php';
$need_gold = $price_card_level[$up['card_lvl']]-$user['gold'];
echo '<div id="error">Не хватает '.$need_gold.' золота</div>';
require_once 'bot.php';
echo '</body></html>';
exit;
}else{
header("Location: card.php"

;
require_once 'head.php';
echo '<div class="header">';
echo '<div class="black_row-Option t_center" style="width: 280px;">';
echo 'Уровень карты увеличен';
#echo $price_card_level[$up['card_lvl']];
mysql_query("UPDATE `user_cards`
SET
`card_lvl`=`card_lvl`+'1',`total_cards`=`total_cards`-'".$card_level[$up['card_lvl']]."'
WHERE `id`='".$upgrade."'"

;
mysql_query("UPDATE `users`
SET `gold`=`gold`-'".$price_card_level[$up['card_lvl']]."'
WHERE `id`='".$user['id']."'"

;
echo '</div>';
echo '</div>'; }
exit;
} [/code]