42 lines
1.1 KiB
PHP
Executable File
42 lines
1.1 KiB
PHP
Executable File
<?php
|
|
echo file_get_contents("ddd_source.html");
|
|
|
|
$db_path = 'db/ddd_db.sqlite';
|
|
$db = new SQLite3($db_path);
|
|
|
|
$b64 = $_POST["gamePass"];
|
|
$decode = base64_decode($b64, true);
|
|
$dataArr = explode("|", $decode);
|
|
$name = $dataArr[0];
|
|
$score = $dataArr[1];
|
|
$mode = $dataArr[2];
|
|
|
|
// Retrieve the boss names dynamically
|
|
$bosses = array_slice($dataArr, 3);
|
|
|
|
// Join the boss names into a single string separated by commas
|
|
$bossNames = implode(", ", $bosses);
|
|
|
|
echo $name . "<br>" . $score . "<br>" . $mode . "<br>";
|
|
echo "Bosses: " . $bossNames . "<br>";
|
|
|
|
// Prepare an SQL statement
|
|
$stmt = $db->prepare("INSERT INTO scores (Name, Score, Mode, Bosses) VALUES (?, ?, ?, ?)");
|
|
$stmt->bindValue(1, $name, SQLITE3_TEXT);
|
|
$stmt->bindValue(2, $score, SQLITE3_INTEGER);
|
|
$stmt->bindValue(3, $mode, SQLITE3_TEXT);
|
|
$stmt->bindValue(4, $bossNames, SQLITE3_TEXT);
|
|
|
|
// Execute the statement
|
|
if ($stmt->execute()) {
|
|
echo "New record created successfully";
|
|
} else {
|
|
echo "Error: " . $db->lastErrorMsg();
|
|
}
|
|
|
|
$stmt->close();
|
|
$db->close();
|
|
?>
|
|
<br>
|
|
<a class='ddd' href='ddd_index.php'>Back</a>
|