login/post: handler renamed from emulate page
[minimedit.git] / login / post / index.php
diff --git a/login/post/index.php b/login/post/index.php
new file mode 100644 (file)
index 0000000..c3439a1
--- /dev/null
@@ -0,0 +1,23 @@
+<?php
+if ($username = @$_REQUEST['login']) {
+       try {
+               $user = new User("profile/$username");
+       }
+       catch (Exception $e) {
+               printf('<p class=warn>%s</p>', $e->getMessage());
+               return;
+       }
+       $Article->title = $user->login . ': ' . $Article->title;
+}
+else {
+       $user = $User;
+}
+
+$Place['login/name'] = $user->name ?: 'bewoner';
+$Place['user'] = $user->login;
+if ( $password = trim(@file_get_contents("{$user->dir}/.passwd")) ) {
+       if (substr($password, 0, 1) == '$') {
+               $password = NULL; // hashed
+       }
+       $Place['pass'] = htmlspecialchars($password) ?: '<em>zelf ingesteld</em>';
+}