nieuws: dynamic article system
[minimedit.git] / login.php
index 801ba1fd1ce73c17e2384b9ef3efae94c45ae8d6..5287678ce1d7c542eb66b65125fadcb68bfeafbd 100644 (file)
--- a/login.php
+++ b/login.php
@@ -1,7 +1,24 @@
 <?php
 $message = NULL;
 
-if (isset($_POST['login'])) {
+if (isset($_POST['mail'])) {
+       $input = trim($_POST['mail']);
+       $inputq = sprintf('<em>%s</em>', $input);
+       try {
+               require_once 'login/mailpass.inc.php';
+               if ( $found = mailtoken($input) ) {
+                       $message = "Er is een e-mail verstuurd naar $inputq.";
+               }
+               else {
+                       $message = "E-mailadres $inputq is nergens ingesteld.";
+               }
+       }
+       catch (Exception $e) {
+               $message = "E-mail kon niet verstuurd worden."
+                       . " Probeer het later nog eens of neem contact op.";
+       }
+}
+elseif (isset($_POST['login'])) {
        if ($User = login($_POST['login'], $_POST['pass'])) {
                login_setcookie();
        }
@@ -37,6 +54,6 @@ $part = [
 print getoutput($part);
 
 if (empty($Args) and !empty($User['admin'])) {
-       include_once 'admin/index.html';
-       include_once 'admin.php';
+       include_once 'login/admin.html';
+       include_once 'login/admin.php';
 }