Support options from array
[misc/kostenrechnung] / lib / general.php
index 215eee4..c296728 100644 (file)
@@ -1,5 +1,21 @@
 <?php
 
+function check_session()
+{
+  if (!empty($_POST['login']) && !empty($_POST['passwd'])) {
+    require_once('lib/login.php');
+    if (check_passwd()) {
+      header('Location: ./');
+      exit();
+    }
+  }
+
+  if (empty($_SESSION['sys']['login']) && empty($_GET['login'])) {
+    header('Location: ./?login=true');
+    exit();
+  }
+}
+
 function sanitise_filename($file)
 {
   return str_replace('./','x',$file);
@@ -40,6 +56,11 @@ function load_js($jsfiles, $jscode)
 
 function process()
 {
+  if (!empty($_GET['login'])) {
+    require_once('lib/login.php');
+    return mask_login();
+  }
+
   if (!empty($_GET['mask'])) {
     require_once('lib/mask.php');
     return mask($_GET['mask']);