50, 41 => 100, 42 => 250, 43 => 500, 44 => 1000, 45 => 2500, 46 => 5000, 47 => 10000, 48 => 25000 ]; if (!$BadgeID) { $Err = 'No badge specified'; } elseif (!in_array($BadgeID, $ShopBadgeIDs)) { $Err = 'Invalid badge ID'; } elseif (Badges::has_badge($UserID, $BadgeID)) { $Err = 'You already have this badge'; } elseif ((int) $BadgeID !== $ShopBadgeIDs[0] && !Badges::has_badge($UserID, $ShopBadgeIDs[array_search($BadgeID, $ShopBadgeIDs)-1])) { $Err = "You haven't purchased the badges before this one!"; } if (isset($_GET['confirm']) && $_GET['confirm'] === '1') { if (!isset($Err)) { $DB->query(" SELECT BonusPoints FROM users_main WHERE ID = $UserID"); if ($DB->has_results()) { list($BP) = $DB->next_record(); $BP = (int) $BP; if ($BP >= $Prices[$BadgeID]) { if (!Badges::award_badge($UserID, $BadgeID)) { $Err = 'Could not award badge, unknown error occurred.'; } else { $DB->query(" UPDATE users_main SET BonusPoints = BonusPoints - " . $Prices[$BadgeID] ." WHERE ID = $UserID"); $DB->query(" UPDATE users_info SET AdminComment = CONCAT('".sqltime()." - Purchased badge $BadgeID from store\n\n', AdminComment) WHERE UserID = $UserID"); $Cache->delete_value("user_info_heavy_$UserID"); } } else { $Err = 'Not enough '.BONUS_POINTS.'.'; } } } View::show_header('Store'); ?>
=isset($Err)?'Error: '.$Err:'You have purchased a badge'?>
Badge cost: =number_format($Prices[$BadgeID])?> =BONUS_POINTS?>
Error: =$Err?>