BioTorrents.de’s version of Gazelle
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.8KB

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