summaryrefslogtreecommitdiff
path: root/www/login.php
diff options
context:
space:
mode:
Diffstat (limited to 'www/login.php')
-rwxr-xr-xwww/login.php20
1 files changed, 17 insertions, 3 deletions
diff --git a/www/login.php b/www/login.php
index 3207703..0e281e5 100755
--- a/www/login.php
+++ b/www/login.php
@@ -18,10 +18,11 @@
*/
?>
-<?php include("static/header.html");?>
+<?php include("static/header.html");
+require_once("include.php");?>
<link rel="stylesheet" type="text/css" href="/static/login.css">
-
+ <?php if(!isset($_POST['login'])){?>
<div class="login-area">
<h1 class="login-area"> Log in </h1>
<div class="login-area" id="login-info-bar">
@@ -36,7 +37,7 @@
';
}?>
</div>
- <form id="login-form" method='post' action='/login'>
+ <form id="login-form" method='post' action='login.php'>
<?php if(isset($_GET['reason']) && $_GET['reason'] == 'failure' && isset($_GET['username'])){
echo '<input type="text" placeholder="username" name="username" id="username-input" class="login-input" value="'.$_GET['username'].'"required>
';
@@ -50,5 +51,18 @@
<a href="recover-password.php" id="recover-password-link">recover password</a>
</form>
</div>
+
+ <?php
+ }else{
+ $username = $_POST['username'];
+ $password = $_POST['password'];
+ if(($result=login($username, $password)=="success")){
+ header("Refresh: 0; /");
+ }else{
+ echo $result;
+ exit;
+ header("Refresh: 0; /login.php?reason=".$result."&username=".$username);
+ }
+ }?>
<?php include("static/footer.html");?>