Website Summary Files Commits Branches @commit @diff @stats
path: root / views / user / authenticate.php
diff options
context:
space:
mode:
Commit0d5738a2bc9dd4f5edf582f7cea3614bcbb44842 (patch)
Author
 Syndamia <kamen@syndamia.com>
2025-02-02 12:23:02 +0200
Committer
 Syndamia <kamen@syndamia.com>
2025-02-02 12:23:02 +0200
Files1ddb7845d85ff5126e33c3e72cbcc18c2f31b511 /views/user/authenticate.php
nowayforward_human-0d5738a2bc9dd4f5edf582f7cea3614bcbb44842.tar
nowayforward_human-0d5738a2bc9dd4f5edf582f7cea3614bcbb44842.tar.gz
nowayforward_human-0d5738a2bc9dd4f5edf582f7cea3614bcbb44842.zip
Parent14c84a83bcad285219539821647ee2d988eabaa8 (diff)
feat!(views): Rename profile to user
1 files changed, 24 insertions, 0 deletions
-rw-r--r--views/user/authenticate.php24
diff --git a/views/user/authenticate.php b/views/user/authenticate.php
new file mode 100644
index 0000000..e4cf47e
--- /dev/null
+++ b/views/user/authenticate.php
@@ -0,0 +1,24 @@
+<?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;
+}
+
+try {
+ $user = Database\Cookie::fromDB($TOKEN);
+
+ http_response_code(200);
+ header('Content-Type: text/plain');
+ echo $user->Username;
+}
+catch(Exception $e) {
+ http_response_code(401);
+ header('Content-Type: text/plain');
+ echo 'Bad token!';
+}
+
+exit;