Contributing back some bug fixes
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

title.php 1.7KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. <?
  2. if (isset($_POST['title'])) {
  3. if (strlen($_POST['title']) > 30) error("Title too long");
  4. $Title = htmlspecialchars($_POST['title'], ENT_QUOTES);
  5. $UserID = $LoggedUser['ID'];
  6. $DB->query("
  7. SELECT BonusPoints
  8. FROM users_main
  9. WHERE ID = $UserID");
  10. if ($DB->has_results()) {
  11. list($Points) = $DB->next_record();
  12. if ($Points >= 50000) {
  13. $DB->query("
  14. UPDATE users_main
  15. SET BonusPoints = BonusPoints - 50000,
  16. Title = ?
  17. WHERE ID = ?", $Title, $UserID);
  18. $DB->query("
  19. UPDATE users_info
  20. SET AdminComment = CONCAT(NOW(), ' - Changed title to ', ?, ' via the store\n\n', AdminComment)
  21. WHERE UserID = ?", $Title, $UserID);
  22. $Cache->delete_value('user_info_'.$UserID);
  23. $Cache->delete_value('user_info_heavy_'.$UserID);
  24. } else {
  25. error("Not enough points");
  26. }
  27. }
  28. View::show_header('Store'); ?>
  29. <div class="thin">
  30. <h2 id="general">Purchase Successful</h2>
  31. <div class="box pad" style="padding: 10px 10px 10px 20px;">
  32. <p>You purchased the title "<? print $Title ?>"</p>
  33. <p><a href="/store.php">Back to Store</a></p>
  34. </div>
  35. </div>
  36. <? View::show_footer();
  37. } else {
  38. View::show_header('Store'); ?>
  39. <div class="thin">
  40. <div class="box pad" style="padding: 10px 10px 10px 20px; text-align: center;">
  41. <form action="store.php" method="POST">
  42. <input type="hidden" name="item" value="title">
  43. <strong>
  44. Enter the title you want
  45. </strong>
  46. <br>
  47. <input type="text" name="title" maxlength="30" value="">
  48. <input type="submit">
  49. </form>
  50. <p><a href="/store.php">Back to Store</a></p>
  51. </div>
  52. </div>
  53. <? View::show_footer();
  54. }
  55. ?>