I need a online script for my badgeshop because lets say a badge is 1000c when a user is online it doesnt take away that 1000c from the user but when the user is offline then it does can someone help be this is the badgeshop code:
If someone could help me it would be helpfulCode:</ul> </div> </div> <?php include('includes/alerts.php'); ?> <div id="container"> <div id="content" style="position: relative" class="clearfix"> <div id="column2" class="column"> <div class="habblet-container "> <div class="cbb clearfix darkred"> <h2 class="title">My Badges</h2> <div style="padding:5px;align:center"> <?php $getUserBadges = mysql_query("SELECT * FROM user_badges WHERE user_id='". $_SESSION['user']['id'] ."'"); while($showBadges = mysql_fetch_array($getUserBadges)) { echo '<div style="padding:1px;height:60px;float:left"><img src="http://hotelurl/game/c_images/album1584/', $showBadges['badge_id'] ,'.gif?1111" draggable="false"></div>'; } ?> </div> </div> </div> </div> <script type="text/javascript">if (!$(document.body).hasClassName('process-template')) { Rounder.init(); }</script> <?php if(isset($_POST['buyBadge'])) { $badge_id = mysql_real_escape_string($_POST['badge_id']); $getBadgeCount = mysql_query("SELECT * FROM user_badges WHERE badge_id = '".$badge_id."' AND user_id = '". $_SESSION['user']['id'] ."'"); $badgeCount = mysql_num_rows($getBadgeCount); if($badgeCount > 0) { $err = '<br><span style="color:#FFFFFF;background-color:#c70000;padding:10px;border-radius:5px"><strong>You already have this badge.</strong></span><br><br>'; } else { $validateBadge = mysql_num_rows(mysql_query("SELECT null FROM badge_shop WHERE badge_id = '".$badge_id."'")); if($validateBadge == 0) { $err = '<br><span style="color:#FFFFFF;background-color:#c70000;padding:10px;border-radius:5px"><strong>This badge is not for sale.</strong></span><br><br>'; } else { $getUserCredits = mysql_fetch_array(mysql_query("SELECT credits FROM users WHERE id = '". $_SESSION['user']['id'] ."'")); $getBadgeCost = mysql_fetch_array(mysql_query("SELECT badge_id,cost FROM badge_shop WHERE badge_id = '".$badge_id."'")); if($getBadgeCost['cost'] > $getUserCredits['credits']) { echo '<br><span style="color:#FFFFFF;background-color:#c70000;padding:10px;border-radius:5px"><strong>You do not have enough credits to purchase this badge.</strong></span><br><br>'; } else { echo '<br><span style="color:#FFFFFF;background-color:#099f00;padding:10px;border-radius:5px"><strong>Congratulations, you purchased ', $getBadgeCost['badge_id'],' you may need to reload.</strong></span><br><br>'; mysql_query("INSERT INTO user_badges (user_id, badge_id) VALUES ('". $_SESSION['user']['id'] ."','". $badge_id ."')"); $cost = $getBadgeCost['cost']; //nope, it didnt mysql_query("UPDATE `users` SET `credits` = credits - $cost WHERE `id` = '".$_SESSION['user']['id']."' LIMIT 1") or die(mysql_error()); } } } ?> <div id="column1" class="column"> <?php $getBadgeStore = mysql_query("SELECT * FROM badge_shop"); while ($showBadgeStore = mysql_fetch_array($getBadgeStore)) { echo '<div class="habblet-container"> <div class="cbb clearfix darkred"> <div id="Credits-info" class="box-content Credits-info"> <div class="Credits-info-text clearfix"> <table width="100%" no-border> <tr> <td width="35%" valign="middle"><b>',$showBadgeStore['title'],' (',$showBadgeStore['badge_id'],')</b><br><i>',$showBadgeStore['description'],'</i></td> <td width="15%" valign="middle"><img src="http://hotelurl/game/c_images/album1584/', $showBadgeStore['badge_id'] ,'.gif?1111" draggable="false"></td>'; if ($showBadgeStore['cost'] == 1) echo '<td width="25%" valign="middle">',$showBadgeStore['cost'],' <b>Credits</b></td>'; else if ($showBadgeStore['cost'] > 1) echo '<td width="25%" valign="middle">',$showBadgeStore['cost'],' <b>Credits</b></td>'; $getBadgeCount = mysql_query("SELECT null FROM user_badges WHERE badge_id = '".$showBadgeStore['badge_id']."' AND user_id = '". $_SESSION['user']['id'] ."'"); $badgeCount = mysql_num_rows($getBadgeCount); if($badgeCount == 0) { echo'<td width="25%" valign="middle"><div class="settings-buttons"><form method="post"><input type="hidden" name="badge_id" value="',$showBadgeStore['badge_id'],'"/><input type="submit" value="Purchase" name="buyBadge" class="submit"></form></div></td> '; } else { echo'<td width="25%" valign="middle"><i>Purchased</i></td> '; } echo' </tr> </table> </div> </div> </div> </div> '; } ?> </div> </div> </div> <script type="text/javascript">if (!$(document.body).hasClassName('process-template')) { Rounder.init(); }</script> <div id="footer" > <?php include('includes/footer.php'); ?> <?php include('includes/checktheban.php'); ?> </div> </body> </html>


Reply With Quote

