WebOrbiton
v1.0.0.0

StocketBase

21 lines · 375 B
  1. <?php
  2. ​
  3. declare(strict_types=1);
  4. ​
  5. if (count(get_included_files()) === 1) {
  6. http_response_code(403);
  7. exit;
  8. }
  9. ​
  10. if (!Auth::hasRoleAtLeast(Auth::ROLE_STORE_MANAGER)) {
  11. return;
  12. }
  13. ​
  14. $discountId = (int) ($_POST['discount_id'] ?? 0);
  15. ​
  16. if ($discountId <= 0) {
  17. return;
  18. }
  19. ​
  20. Database::site()->prepare('DELETE FROM discounts WHERE id = :id')->execute(['id' => $discountId]);
  21. ​