fixes klumpy api
This commit is contained in:
@@ -39,7 +39,7 @@ if (array_key_exists("board", $_POST) && array_key_exists("history", $_POST) &&
|
||||
$points = array_sum(json_decode(join("", $points)));
|
||||
if ($points > 0 && $points == intval($_POST["points"]) && $_POST["type"] == "main" && valid_moves(json_decode($OGPOST["board"], true), json_decode($OGPOST["history"], true))) {
|
||||
if ($USERNAME) {
|
||||
dbCommand("INSERT INTO klumpy `type`, username, score, board, history) VALUES (?, ?, ?, ?, ?, ?)", [$_POST["type"], $USERNAME, $points, $OGPOST["board"], $OGPOST["history"]]);
|
||||
dbCommand("INSERT INTO klumpy (`type`, username, score, board, history) VALUES (?, ?, ?, ?, ?)", [$_POST["type"], $USERNAME, $points, $OGPOST["board"], $OGPOST["history"]]);
|
||||
}
|
||||
http_response_code(200);
|
||||
// Gets the leaderboard position
|
||||
|
||||
@@ -130,6 +130,15 @@ function dbCommand($command, $prepare = [])
|
||||
$stmt = mysqli_prepare($connection, $command);
|
||||
mysqli_stmt_bind_param($stmt, "ssss", $parameter1, $parameter2, $parameter3, $parameter4);
|
||||
mysqli_stmt_execute($stmt);
|
||||
} elseif ($length == 5) {
|
||||
$parameter1 = $prepare[0];
|
||||
$parameter2 = $prepare[1];
|
||||
$parameter3 = $prepare[2];
|
||||
$parameter4 = $prepare[3];
|
||||
$parameter5 = $prepare[4];
|
||||
$stmt = mysqli_prepare($connection, $command);
|
||||
mysqli_stmt_bind_param($stmt, "sssss", $parameter1, $parameter2, $parameter3, $parameter4, $parameter5);
|
||||
mysqli_stmt_execute($stmt);
|
||||
} elseif ($length == 6) {
|
||||
$parameter1 = $prepare[0];
|
||||
$parameter2 = $prepare[1];
|
||||
|
||||
Reference in New Issue
Block a user