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.7KB

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