Flytta endepunkter inn i api/
This commit is contained in:
18
api/is_authorized.php
Normal file
18
api/is_authorized.php
Normal file
@@ -0,0 +1,18 @@
|
||||
<?php
|
||||
$documentRoot = $_SERVER['DOCUMENT_ROOT'];
|
||||
print_r($documentRoot);
|
||||
$hash = file_get_contents("$documentRoot/data/hash.txt");
|
||||
$method = $_SERVER['REQUEST_METHOD'];
|
||||
if ($method == "POST") {
|
||||
$password = $_POST['password'];
|
||||
if (!password_verify($password, $hash)) {
|
||||
http_response_code(response_code: 401);
|
||||
}
|
||||
else {
|
||||
http_response_code(response_code: 200);
|
||||
}
|
||||
}
|
||||
else {
|
||||
http_response_code(response_code: 405);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user