M4son
In your mind
- Jan 2, 2014
- 35
- 14
Hello Devbest, I'm having issues with my Badge Shop for REVCMS.
Everything works, until you try and click on the 'Buy now' button.
Here is the page:
When I click "Buy now" for a badge, I get this error:
I'm out of the client as well.
Lastly, here is the page code:
I'm not sure, it could probably be an easy fix but I have no idea.
If anyone can help, i'd appreciate it. Thanks!
Everything works, until you try and click on the 'Buy now' button.
Here is the page:
When I click "Buy now" for a badge, I get this error:
I'm out of the client as well.
Lastly, here is the page code:
PHP:
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<title>{hotelName} - Badges</title>
<link rel="stylesheet" href="{url}/app/tpl/skins/Habbo/styles/common.css" type="text/css">
<script type="text/javascript" src="{url}/app/tpl/skins/Habbo/js/libs2.js"></script>
<script type="text/javascript" src="{url}/app/tpl/skins/Habbo/js/visual.js"></script>
<script type="text/javascript" src="{url}/app/tpl/skins/Habbo/js/libs.js"></script>
<script type="text/javascript" src="{url}/app/tpl/skins/Habbo/js/common.js"></script>
<script type="text/javascript" src="{url}/app/tpl/skins/Habbo/js/fullcontent.js"></script>
<link rel="shortcut icon" href="{url}/favicon.ico" type="image/vnd.microsoft.icon" /><script
<script type="text/javascript">
document.habboLoggedIn = true;
var habboName = "{username}";
var habboId = {userid};
var habboReqPath = "";
var habboStaticFilePath = "{url}/app/tpl/skins/Habbo";
var habboImagerUrl = "http://core-hotel.com/habbo-imaging/";
var habboPartner = "";
var habboDefaultClientPopupUrl = "{url}/client";
window.name = "habboMain";
if (typeof HabboClient != "undefined") {
HabboClient.windowName = "eac955c8dbc88172421193892a3e98fc7402021a";
HabboClient.maximizeWindow = true;
}
</script>
<!--[if IE 8]>
<link rel="stylesheet" href="{url}/app/tpl/skins/Habbo/styles/ie8.css" type="text/css">
<![endif]-->
<!--[if lt IE 8]>
<link rel="stylesheet" href="{url}/app/tpl/skins/Habbo/styles/ie.css" type="text/css" />
<![endif]-->
<!--[if lt IE 7]>
<link rel="stylesheet" href="{url}/app/tpl/skins/Habbo/styles/ie6.css" type="text/css" />
<script type="text/javascript" src="{url}/app/tpl/skins/Habbo/js/pngfix.js"></script>
<script type="text/javascript">
try { document.execCommand('BackgroundImageCache', false, true); } catch(e) {}
</script>
<style type="text/css">
body { behavior: url({url}/app/tpl/skins/Habbo/js/csshover.htc); }
</style>
<![endif]-->
</head>
<body id="home">
<div id="overlay"></div>
<div id="header-container">
<div id="header" class="clearfix">
<h1><a href="{url}/"></a></h1>
<div id="subnavi">
<div id="subnavi-user">
<div style="margin-top:7px;font-size:10px">
<?php include"randomFacts.php" ?>
</div>
</div>
<div id="subnavi-search">
<div id="subnavi-search-upper">
<ul id="subnavi-search-links">
<li><a href="{url}/logout" style="color:#000;font-size:10px;">Sign Out</a>
</ul>
</div>
</div>
<div id="to-hotel">
<a href="{url}/client" class="new-button green-button" target="05efbade773135677a28f2b338c5bdf93774237c" onclick="HabboClient.openOrFocus(this); return false;"><b>Enter Spark Hotel</b><i></i></a>
</div>
</div>
<ul id="navi">
<li><a href="{url}/me">{username}</a><span></span></li>
<li><a href="{url}/community">Community</a><span></span></li>
<li class="viptab selected"><strong>Shop</strong><span></span></li>
</ul>
<div id="habbos-online"><div class="rounded"><span>{online} members online</span></div></div>
</div>
</div>
</div>
</div>
<div id="content-container">
<div id="navi2-container" class="pngbg">
<div id="navi2" class="pngbg clearfix">
<ul>
<?php include_once "inc/home_nav.php" ?>
</ul>
</div>
</div></div>
<div id="container">
<div id="content" style="position: relative" class="clearfix">
<div id="column1" class="column">
<div class="habblet-container">
<div class="cbb clearfix red">
<h2 class="title">Badge Shop</h2>
<div id="Credits-info" class="box-content Credits-info">
<div class="Credits-info-text clearfix">
<center>Select the badge that you would like to purchase.</center>
<center>New badges added every week!</center>
<hr style="margin: 10px 0;" />
<?php
// Create Array for Badge Codes/Costs in Credits
$badgeCodes = array('HH1', 'GM1', 'GM2', 'GM3', 'UK120', 'UK119', 'UK067', 'UK045');
$badgeCosts = array(1000, 25000, 25000, 25000, 25000, 25000, 25000, 25000);
$subCode = $_GET['id'];
if(isset($subCode)){
$badgeExsist = false;
for($i = 0; $i < sizeof($badgeCodes); $i++){
if($subCode == $badgeCodes[$i]){
// Check to see if user has badge
$hasBadgeCheck = mysql_query('SELECT * FROM user_badges WHERE user_id = '.$_SESSION['user']['id'].' AND badge_id = "'.$badgeCodes[$i].'"')or die(mysql_error());
if(mysql_num_rows($hasBadgeCheck) < 1){
// check Credits
$creditCheck = mysql_query('SELECT * FROM users WHERE id = '.$_SESSION['user']['id'].'')or die(mysql_error());
$gotCreditCheck = mysql_fetch_assoc($creditCheck);
if($gotCreditCheck['credits'] >= $badgeCosts[$i]){
$removeCredits = mysql_query('UPDATE users SET Credits = Credits - '.$badgeCosts[$i].' WHERE id = '.$_SESSION['user']['id'].'')or die(mysql_error());
$giveUserBadge = mysql_query('INSERT INTO user_badges (user_id, badge_id) VALUES ('.$_SESSION['user']['id'].',"'.$badgeCodes[$i].'")')or die(mysql_error());
$_SESSION['user']['credits'] = $_SESSION['user']['credits'] - $badgeCosts[$i];
echo '<div id="badge-container-error" style="background-color:green;"><center><font color="white"> You have recived the badge! You may have to reload.</font></center></div>';
break;
}
else{
// You don't have enough Credits
echo '<div id="badge-container-error">Sorry, you do not have enough credits.</div>';
}
}
else{
// You have badge
echo '<div id="badge-container-error">You already have this badge.</div>';
}
break; // stop loop
}
}
}
echo '<table>';
echo '<tr><td><strong>Badge</strong></td><td><strong>Badge Name</strong></td><td><strong>Cost</strong></td><td><strong>Buy</strong></td></tr>';
for($n = 0; $n < sizeof($badgeCodes); $n++){
// Check to see if user has badge
$hasBadge = mysql_query('SELECT * FROM user_badges WHERE user_id = '.$_SESSION['user']['id'].' AND badge_id = "'.$badgeCodes[$n].'"')or die(mysql_error());
if(mysql_num_rows($hasBadge) < 1){
echo '
<tr>
<td width="50%">
<img src="/swfs/c_images/album1584/'.$badgeCodes[$n].'.gif"/>
<br/>
</td>
<td width="10%">
<center><strong>'.$badgeCodes[$n].'</strong></center>
</td>
<td width="10%">
<center>'.$badgeCosts[$n].' Credits</center>
</td>
<td width="30%">
<center><a href="{url}/index.php?url=badge&id='.$badgeCodes[$n].'"><input type="submit" href="{url}/index.php?url=badge&id='.$badgeCodes[$n].'" value="Buy Now"/></a></center>
</td>
</tr>
';
}
else{
// Don't show the badge.
}
}
echo '</table>';
?>
</div></div>
</div>
</div<
</div>
</div>
<script type="text/javascript">
HabboView.run();
</script>
<!--[if lt IE 7]>
<script type="text/javascript">
Pngfix.doPngImageFix();
</script>
<![endif]-->
<div id="footer" >
</div>
<script type="text/javascript" src="http://code.jquery.com/jquery-latest.js"></script>
<script type="text/javascript">
$(function(){
$("[data-code]").each(function(i,a){
$(a).click(function(){
var bcode = $(this).attr("data-code");
if (confirm("Are you sure you want to purchase this badge?")) {
$.ajax({
type: "POST",
url: "{url}/badgestore/buybadge",
data: "badgeid=" + bcode + "&user={uid}",
success: function(r){
if (r=="ok"){
alert("You have successfully purchased this badge.\n\nThe badge will only be visible to you once you reload the client.");
window.location.reload(true);
}else{
alert(r);
}
},
error: function(){
alert("An error occurred with the AJAX call request.");
}
});
}
return false;
});
});
});
</script>
</body>
</html>
I'm not sure, it could probably be an easy fix but I have no idea.
If anyone can help, i'd appreciate it. Thanks!