v57
This commit is contained in:
parent
cab62424f8
commit
6d5011aef2
@ -1,9 +1,9 @@
|
||||
<?php
|
||||
header('Content-Type: application/json');
|
||||
session_start();
|
||||
require_once 'db/config.php';
|
||||
require_once __DIR__ . '/../db/config.php';
|
||||
|
||||
if (!isset($_SESSION['user_id'])) {
|
||||
header('Content-Type: application/json');
|
||||
echo json_encode(['success' => false, 'error' => 'Unauthorized']);
|
||||
exit;
|
||||
}
|
||||
@ -13,7 +13,6 @@ $action = $_POST['action'] ?? '';
|
||||
$amount = (float)($_POST['amount'] ?? 0);
|
||||
|
||||
if ($amount <= 0) {
|
||||
header('Content-Type: application/json');
|
||||
echo json_encode(['success' => false, 'error' => 'Please enter a valid amount greater than zero.']);
|
||||
exit;
|
||||
}
|
||||
@ -55,7 +54,8 @@ try {
|
||||
}
|
||||
|
||||
} catch (Exception $e) {
|
||||
db()->rollBack();
|
||||
header('Content-Type: application/json');
|
||||
if (db()->inTransaction()) {
|
||||
db()->rollBack();
|
||||
}
|
||||
echo json_encode(['success' => false, 'error' => $e->getMessage()]);
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user