diff options
Diffstat (limited to 'views/profile/authenticate.php')
| -rw-r--r-- | views/profile/authenticate.php | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/views/profile/authenticate.php b/views/profile/authenticate.php new file mode 100644 index 0000000..540d4a3 --- /dev/null +++ b/views/profile/authenticate.php @@ -0,0 +1,27 @@ +<?php + +if ($_SERVER['REQUEST_METHOD'] !== 'POST') { + header('Allow: POST'); + http_response_code(405); + header('Content-Type: text/plain'); + echo $_SERVER['REQUEST_METHOD'] . " request not allowed!"; + exit; +} + +include '../meta.php'; + +$user = null; +runController('user'); + +if ($user !== null) { + http_response_code(200); + header('Content-Type: text/plain'); + echo $user->Username; +} +else { + http_response_code(401); + header('Content-Type: text/plain'); + echo 'Bad token!'; +} + +exit; |
