]> git.datanom.net - qtadmin.git/blobdiff - auth.php
First upload of wblist page
[qtadmin.git] / auth.php
index 120f84b741e5213a2b7323b477bc45fde7857299..6d5210d5979326e028ed0fa71c10d54e7461ca0a 100644 (file)
--- a/auth.php
+++ b/auth.php
@@ -1,37 +1,37 @@
 <?php
 /* vim: set ts=4 tw=0 sw=4 noet: */
 <?php
 /* vim: set ts=4 tw=0 sw=4 noet: */
-       require_once 'config.php';
-       require_once $CFG->root . 'lib/utils.inc.php';
+    require_once 'config.php';
+    require_once $CFG->root . 'lib/utils.inc.php';
 
 
-       $auth_url = $_SERVER['PHP_SELF'] . '?op=login';
-       $login = $_SERVER['PHP_SELF'];
-       $login_form = <<<LF
+    $auth_url = $_SERVER['PHP_SELF'] . '?op=login';
+    $login = $_SERVER['PHP_SELF'];
+    $login_form = <<<LF
 <!DOCTYPE html>
 <html>
 <!DOCTYPE html>
 <html>
-       <head>
-               <meta charset="UTF-8">
-               <title>Login</title>
-               <link rel="stylesheet" href="css/auth.css">
-       </head>
-       <body>
-               <div class="container">
-                       <div id="login-form">
-                               <h3>Login</h3>
-                               <fieldset>
-                                       <form action="$auth_url" method="post">
-                                               <input type="email" name="user" required value="Email" onBlur="if(this.value=='')this.value='Email'" onFocus="if(this.value=='Email')this.value='' "/>
-                                               <input type="password" name="password" required value="Password" onBlur="if(this.value=='')this.value='Password'" onFocus="if(this.value=='Password')this.value='' "/>
-                                               <input type="submit" value="Login"/>
-<!--                                           <footer class="clearfix">
-                                                       <p><span class="info">?</span><a href="#">Forgot Password</a></p>
-                                               </footer>-->
-                                       </form>
-                               </fieldset>
-                       </div> <!-- end login-form -->
-                       <p class="footer">Powered by <a href="https://qtadmin.datanom.net">
-                       QtAdmin</a>. &copy; 2015 by Michael Rasmussen</p>
-               </div>
-       </body>
+    <head>
+        <meta charset="UTF-8">
+        <title>Login</title>
+        <link rel="stylesheet" href="css/auth.css">
+    </head>
+    <body>
+        <div class="container">
+            <div id="login-form">
+                <h3>Login</h3>
+                <fieldset>
+                    <form action="$auth_url" method="post">
+                        <input type="email" name="user" required value="Email" onBlur="if(this.value=='')this.value='Email'" onFocus="if(this.value=='Email')this.value='' "/>
+                        <input type="password" name="password" required value="Password" onBlur="if(this.value=='')this.value='Password'" onFocus="if(this.value=='Password')this.value='' "/>
+                        <input type="submit" value="Login"/>
+<!--                        <footer class="clearfix">
+                            <p><span class="info">?</span><a href="#">Forgot Password</a></p>
+                        </footer>-->
+                    </form>
+                </fieldset>
+            </div> <!-- end login-form -->
+            <p class="footer">Powered by <a href="https://qtadmin.datanom.net">
+            QtAdmin</a>. &copy; 2015 by Michael Rasmussen</p>
+        </div>
+    </body>
 </html>
 LF;
 
 </html>
 LF;
 
@@ -59,29 +59,29 @@ LF;
 </html>
 LE;
 
 </html>
 LE;
 
-       $util = Utils::getInstance();
-       if (isset($_GET['op']))
-               $action = $_GET['op'];
-       else
-               $action = 'default';
+    $util = new Utils;
+    if (isset($_GET['op']))
+        $action = $_GET['op'];
+    else
+        $action = 'default';
 
 
-       if ($action == 'logout') {
-               // logout
-               $util->logout();
-               echo $login_form;
-       } else if ($action == 'login') {
-               // login
-               $user = $_POST['user'];
-               $password = $_POST['password'];
-               if ($util->login($user, $password)) {
-                       header('Location: index.php');
-               } else {
-                       $error = $util->getLoginStatus();
-                       $error = str_replace('__ERROR__', $error, $login_error);
-                       echo $error;
-               }
-       } else {
-               echo $login_form;
-       }                       
+    if ($action == 'logout') {
+        // logout
+        $util->logout();
+        echo $login_form;
+    } else if ($action == 'login') {
+        // login
+        $user = $_POST['user'];
+        $password = $_POST['password'];
+        if ($util->login($user, $password)) {
+            header('Location: index.php');
+        } else {
+            $error = $util->getLoginStatus();
+            $error = str_replace('__ERROR__', $error, $login_error);
+            echo $error;
+        }
+    } else {
+        echo $login_form;
+    }
 ?>
 
 ?>
 
This page took 0.051777 seconds and 5 git commands to generate.