diff --git a/api/wallet_transaction.php b/api/wallet_transaction.php index d5fa388..afed15a 100644 --- a/api/wallet_transaction.php +++ b/api/wallet_transaction.php @@ -14,7 +14,7 @@ $amount = (float)($_POST['amount'] ?? 0); if ($amount <= 0) { header('Content-Type: application/json'); - echo json_encode(['success' => false, 'error' => 'Invalid amount']); + echo json_encode(['success' => false, 'error' => 'Please enter a valid amount greater than zero.']); exit; } @@ -27,7 +27,7 @@ try { $user = $stmt->fetch(); if (!$user) { - throw new Exception("User not found"); + throw new Exception("User account not found."); } $current_balance = (float)$user['balance']; @@ -37,13 +37,11 @@ try { $stmt = db()->prepare("UPDATE users SET balance = ? WHERE id = ?"); $stmt->execute([$new_balance, $user_id]); - // Log transaction (optional but good practice, maybe later) - db()->commit(); echo json_encode(['success' => true, 'new_balance' => $new_balance]); } elseif ($action === 'withdraw') { if ($current_balance < $amount) { - throw new Exception("Insufficient funds"); + throw new Exception("Insufficient funds. Your current balance is £" . number_format($current_balance, 2) . "."); } $new_balance = $current_balance - $amount; @@ -53,11 +51,11 @@ try { db()->commit(); echo json_encode(['success' => true, 'new_balance' => $new_balance]); } else { - throw new Exception("Invalid action"); + throw new Exception("Invalid wallet action requested."); } } catch (Exception $e) { db()->rollBack(); header('Content-Type: application/json'); echo json_encode(['success' => false, 'error' => $e->getMessage()]); -} +} \ No newline at end of file diff --git a/dashboard.php b/dashboard.php index 53a0e44..c9a3661 100644 --- a/dashboard.php +++ b/dashboard.php @@ -123,22 +123,22 @@ function number_get_formatted($num) { .modal { display: none; position: fixed; - z-index: 1000; + z-index: 2000; left: 0; top: 0; width: 100%; height: 100%; - background-color: rgba(0,0,0,0.8); - backdrop-filter: blur(5px); + background-color: rgba(0,0,0,0.85); + backdrop-filter: blur(8px); } .modal-content { background-color: #1a1a24; margin: 10% auto; padding: 40px; border: 1px solid var(--border-color); - width: 400px; + width: 420px; border-radius: 32px; - box-shadow: 0 25px 50px rgba(0,0,0,0.5); + box-shadow: 0 25px 60px rgba(0,0,0,0.7); } @@ -162,6 +162,12 @@ function number_get_formatted($num) { Messages