aboutsummaryrefslogtreecommitdiff
path: root/controllers
diff options
context:
space:
mode:
authorSyndamia <kamen@syndamia.com>2025-01-25 19:31:14 +0200
committerSyndamia <kamen@syndamia.com>2025-01-25 19:59:25 +0200
commitf7db20f6a635a4195647941a8c150a1bb3fcf904 (patch)
treed2498a078139fc1caebcf83ae5d05d9acaf88550 /controllers
parent046dc2e32512dad2458be3e367e16e6e1a6f46f3 (diff)
downloadnowayforward_human-f7db20f6a635a4195647941a8c150a1bb3fcf904.tar
nowayforward_human-f7db20f6a635a4195647941a8c150a1bb3fcf904.tar.gz
nowayforward_human-f7db20f6a635a4195647941a8c150a1bb3fcf904.zip
feat(views): Add basic profile and register views
Diffstat (limited to 'controllers')
-rw-r--r--controllers/register.php19
-rw-r--r--controllers/user.php9
2 files changed, 28 insertions, 0 deletions
diff --git a/controllers/register.php b/controllers/register.php
new file mode 100644
index 0000000..3e8d416
--- /dev/null
+++ b/controllers/register.php
@@ -0,0 +1,19 @@
+<?php
+
+function on_post() {
+ global $status;
+ $status = "";
+ try {
+ Database\User::fromDB($_POST["username"]);
+ $status = "User \"" . $_POST["username"] . "\" already exists!";
+ return;
+ }
+ catch(Exception $e) {}
+
+ try {
+ Database\User::create($_POST["username"], $_POST["password"], "User");
+ }
+ catch(Exception $e) {
+ $status = $e;
+ }
+}
diff --git a/controllers/user.php b/controllers/user.php
new file mode 100644
index 0000000..f26103e
--- /dev/null
+++ b/controllers/user.php
@@ -0,0 +1,9 @@
+<?php
+
+function on_get() {
+ global $user;
+ try {
+ $user = Database\User::fromDB($_GET["user"]);
+ }
+ catch(Exception $e) {}
+}