angelicatesvara07-crypto d27b2bf3f9 Leaderboard Fix
2025-12-15 19:57:21 +07:00

30 lines
599 B
PHP

<?php
session_start();
require_once 'db.php';
if (!isset($_SESSION['username'])) {
echo "NO_SESSION";
exit;
}
if (!isset($_POST['difficulty'], $_POST['time'])) {
echo "NO_POST";
exit;
}
$username ='testuser';
$difficulty = $_POST['difficulty'];
$time = (int) $_POST['time'];
$sql = "INSERT INTO leaderboard_sudoku
(username, difficulty, time_seconds)
VALUES (:username, :difficulty, :time)";
$stmt = $conn->prepare($sql);
$stmt->execute([
':username' => $username,
':difficulty' => $difficulty,
':time' => $time
]);
echo "SUCCESS";