Initial Push

This commit is contained in:
2026-03-30 20:03:34 +02:00
parent 6ddb6a3ffd
commit ab0e19ef34
10 changed files with 519 additions and 0 deletions
+39
View File
@@ -0,0 +1,39 @@
<?php
// On commence par session_start AVANT tout envoi de texte
session_start();
header('Content-Type: application/json');
// Configuration BDD
$host = 'localhost';
$db = 'yahtzee_paf';
$user = 'root';
$pass = '';
$options = [
PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION,
PDO::ATTR_DEFAULT_FETCH_MODE => PDO::FETCH_ASSOC,
PDO::ATTR_EMULATE_PREPARES => false,
PDO::ATTR_STRINGIFY_FETCHES => false,
];
try {
$pdo = new PDO("mysql:host=$host;dbname=$db;charset=utf8", $user, $pass, $options);
} catch (Exception $e) {
echo json_encode(['success' => false, 'error' => 'Connexion échouée']);
exit;
}
// Lecture de l'input
$json = file_get_contents('php://input');
$data = json_decode($json, true);
if (!$data || !isset($data['action'])) {
echo json_encode(['success' => false, 'error' => 'Aucune action spécifiée']);
exit;
}
$action = $data['action'];
$params = $data['params'] ?? [];
switch ($action) {
case "":