From e1af8fc4977fe1d186a89930197276e16a2a245b Mon Sep 17 00:00:00 2001 From: Matthew Florentino Date: Mon, 1 Dec 2025 09:34:11 +0700 Subject: [PATCH] test: otw diambil bram --- src/js/firstperson.js | 1 - src/js/soal.js | 1 + src/score.php | 4 ++-- 3 files changed, 3 insertions(+), 3 deletions(-) create mode 100644 src/js/soal.js diff --git a/src/js/firstperson.js b/src/js/firstperson.js index a1e9dd4..c3d702f 100644 --- a/src/js/firstperson.js +++ b/src/js/firstperson.js @@ -114,5 +114,4 @@ function postScore(score){ .then(t => console.log("Server response:", t)) .catch(err => console.error("Fetch error:", err)); } - startQuiz() \ No newline at end of file diff --git a/src/js/soal.js b/src/js/soal.js new file mode 100644 index 0000000..edc5db5 --- /dev/null +++ b/src/js/soal.js @@ -0,0 +1 @@ +dadad \ No newline at end of file diff --git a/src/score.php b/src/score.php index cc09e09..9a9ab6e 100644 --- a/src/score.php +++ b/src/score.php @@ -12,14 +12,14 @@ if (!isset($data['score'])) { } $score = (int)$data['score']; -$user_id = isset($_SESSION['user_id']) ? (int)$_SESSION['user_id'] : null; +$user_id = isset($_SESSION['id']) ? (int)$_SESSION['id'] : null; if (!$user_id) { echo json_encode(["error" => "no session user"]); exit; } -$stmt = $db->prepare("INSERT INTO scores (user_id, score) VALUES (?, ?)"); +$stmt = $db->prepare("INSERT INTO scores (id, score) VALUES (?, ?)"); $stmt->bind_param("ii", $user_id, $score); if ($stmt->execute()) {