This commit is contained in:
2026-03-18 15:37:13 +01:00
parent ae75a6ee02
commit 4618269498
188 changed files with 4979 additions and 2 deletions
+29
View File
@@ -0,0 +1,29 @@
<?php
require_once 'db.php';
header('Content-Type: application/json');
$game_id = intval($_POST['game_id']);
$amount = isset($_POST['amount']) ? intval($_POST['amount']) : 0;
try {
// 1. Récupérer l'ID du joueur actuel
$stmt = $db->prepare("SELECT current_player_id FROM games WHERE id = ?");
$stmt->execute([$game_id]);
$game = $stmt->fetch();
$current_player_id = $game['current_player_id'];
// 2. Ajouter l'argent au blind du joueur actuel
$stmt = $db->prepare("UPDATE players SET money = money + ? WHERE id = ?");
$stmt->execute([$amount, $current_player_id]);
// 3. Ajouter le montant au pot de la partie
$stmt = $db->prepare("UPDATE games SET pot = pot + ? WHERE id = ?");
$stmt->execute([$amount, $game_id]);
echo json_encode(['success' => true]);
} catch (Exception $e) {
echo json_encode(['success' => false, 'message' => $e->getMessage()]);
}
?>