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.

upload_1.php 1.2KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. <?php
  2. declare(strict_types=1);
  3. $UserID = $LoggedUser['ID'];
  4. $Purchase = "0.1 GiB upload";
  5. $GiB = 1024*1024*1024;
  6. $Cost = 15;
  7. $DB->prepared_query("
  8. SELECT BonusPoints
  9. FROM users_main
  10. WHERE ID = $UserID");
  11. if ($DB->has_results()) {
  12. list($Points) = $DB->next_record();
  13. if ($Points >= $Cost) {
  14. $DB->prepared_query("
  15. UPDATE users_main
  16. SET BonusPoints = BonusPoints - $Cost,
  17. Uploaded = Uploaded + ($GiB * 0.1)
  18. WHERE ID = $UserID");
  19. $DB->prepared_query("
  20. UPDATE users_info
  21. SET AdminComment = CONCAT('".sqltime()." - $Purchase from the store\n\n', AdminComment)
  22. WHERE UserID = $UserID");
  23. $Cache->delete_value('user_info_heavy_'.$UserID);
  24. $Cache->delete_value('user_stats_'.$UserID);
  25. $Worked = true;
  26. } else {
  27. $Worked = false;
  28. $ErrMessage = "Not enough points";
  29. }
  30. }
  31. View::show_header('Store'); ?>
  32. <div>
  33. <h2>Purchase
  34. <?= $Worked?"Successful":"Failed"?>
  35. </h2>
  36. <div class="box">
  37. <p>
  38. <?= $Worked?("You purchased ".$Purchase):("Error: ".$ErrMessage)?>
  39. </p>
  40. <p>
  41. <a href="/store.php">Back to Store</a>
  42. </p>
  43. </div>
  44. </div>
  45. <?php View::show_footer();