Files
better_guestbook/api/entry/getcustom.php
T

38 lines
794 B
PHP

<?php
// Set internal to false so that the answer goes to the client
if (!isset($internal)) {
$internal = false;
define("API_DIR", "../");
}
// Load Main Library
require_once API_DIR . "api.php";
$api = new gbAPI(true, $internal);
$input = $api->getInput();
// Check given Status
if (!isset($input["status"])) {
$api->answer(400, [
"error" => "missing_fields",
"error_text" => "Some fields are missing"
], true);
return;
}
if ($status !== 0 && $status !== 1 && $status !== 2) {
$api->answer(400, [
"error" => "status_invalid",
"error_text" => "The given status is invalid."
], true);
}
$command = "SELECT * FROM entrys WHERE status = :status";
$response = $api->dbCommand($command, true, true, [
":status" => $status
]);