Adds check for API-key

This commit is contained in:
nikolark committed 2014-08-02 20:19:47 +02:00
1 parent 14a3513237
commit 79af6bfea5
2 files changed
+10

No files matched your search

+7
View File
@@ -33,6 +33,13 @@ if(DB :: isError($conn)) {
}
$conn->setFetchMode(DB_FETCHMODE_ORDERED);
/* Valid API KEY (defined in credentials.php) ? */
if(!isset($_GET['apikey']) || $_GET['apikey'] !== USER_API_KEY) {
set_response_code(400);
echo json_encode(array('error' => "Invalid apikey."));
die();
}
/* Validate params */
if(!isset($_GET['q'])) {
set_response_code(400);