<?php
if(!defined('BRAIN_CMS'))
{
die('Sorry but you cannot access this file!');
}
function buyvip()
{
global $dbh,$config,$lang;
if (isset($_POST['getvip']))
{
if (User::userData('vip_points') >= $config['vipCost'])
{
if (User::userData('online') == 1)
{
return html::error($lang["Vonline"]);
}
else
{
if (User::userData('rank_vip') == $config['vipRankToGet'])
{
return html::error($lang["Valreadyvip"]);
}
else
{
$removeDiamonds = $dbh->prepare("
UPDATE users SET
vip_points=vip_points - :cost
WHERE
id=:id
");
$removeDiamonds->bindParam(':id', $_SESSION['id']);
$removeDiamonds->bindParam(':cost', $config['vipCost']);
$removeDiamonds->execute();
$giveVipRank = $dbh->prepare("
UPDATE users SET
rank_vip = :viprank
WHERE
id=:id
");
$giveVipRank->bindParam(':id', $_SESSION['id']);
$giveVipRank->bindParam(':viprank', $config['vipRankToGet']);
$giveVipRank->execute();
$giveVipBadge = $dbh->prepare("
INSERT INTO
user_badges
(user_id, badge_id, badge_slot)
VALUES
(
:id,
:badgeid,
0
)");
$giveVipBadge->bindParam(':id', $_SESSION['id']);
$giveVipBadge->bindParam(':badgeid', $config['vipBadge']);
$giveVipBadge->execute();
return html::errorSucces($lang["VbuySucces"]);
}
}
}
else
{
return html::error($lang["VnoDimonds"]);
}
}
}
<?php
include_once 'includes/header.php';
?>
<title><?= $config['hotelName'] ?>: <?= $lang["Ccommunity"] ?></title>
<div class="center">
<?php
include_once 'includes/alerts.php';
?>
<div class="columleft">
<div class="box">
<div class="title">
<?= $lang["Vvipheader"] ?>
</div>
<div class="mainBox" style="float;left">
<div class="boxHeader"></div>
<?php echo'<img src="templates\brain\style\images\vip\vip_image.gif" align="right"> '?>
<?= $lang["Vvipwhatsin"] ?>
<?php echo'<img src="templates\brain\style\images\vip\vipbadge.gif" align="left"> '?>
</div>
</div>
</div>
<div class="columright">
<div class="box">
<div class="title green">
<?= $lang["VvipBuyHeader"] ?>
</div>
<?php buyvip(); ?>
<?= $lang["VvipBuyslogan"] ?>
<form method="post">
<input type="submit" class="submit" value="<?= $lang["VvipBuyButton"] ?>" name="getvip" style="margin-top: 10px;">
</form>
</div>
</div>
<?php
include_once 'includes/footer.php';
?>
</div>
</div>
</body>
</html>
delete the other queries so there is only 1... try it.. put back in one of the ones you deleted and remove the other one.. try it.. put back in the last one and remove the other 2... try it..How do I do that?
No you don't you have USERS_BADGES, not user_badges. Change the query to say 'users_badges'I do actually have the ''user_badges'' table