diff --git a/web/index.php b/web/index.php index d168df5..bd2f47b 100644 --- a/web/index.php +++ b/web/index.php @@ -107,14 +107,18 @@ if ($usersfound=="no"){ } elseif ((isset($_POST['login']))&&(isset($_POST['username']))&&(isset($_POST['password']))){ $user = clean($_POST['username']); $pass = clean($_POST['password']); - $sql="SELECT password,admin FROM users WHERE username='$user'"; - $res = $db_handle->query($sql); - while ($row = $res->fetchArray(SQLITE3_ASSOC)){ - if (password_verify($pass, $row['password'])){ - $_SESSION['username']=$user; - $_SESSION['isadmin']=$row['admin']; - } else { - echo "Password not correct!"; + if ($pass == ""){ + echo "$user is not allowed to login withou password."; + } else { + $sql="SELECT password,admin FROM users WHERE username='$user'"; + $res = $db_handle->query($sql); + while ($row = $res->fetchArray(SQLITE3_ASSOC)){ + if (password_verify($pass, $row['password'])){ + $_SESSION['username']=$user; + $_SESSION['isadmin']=$row['admin']; + } else { + echo "Password not correct!"; + } } } } @@ -362,8 +366,8 @@ if (isset($_SESSION['username'])){ } echo "
"; echo ""; - echo ""; - echo ""; + echo "