commit 9421c0e198e43af55fcf03c7a4169f44dea48d89 parent b7fe750b49459adbed8e3ebb5f78b2ec4ed9e4ac Author: Gerco van Woudenbergh <[email protected]> Date: Tue, 21 Mar 2023 13:31:03 +0100 login index Diffstat:
M | index.php | | | 24 | ++++++++++++++---------- |
1 file changed, 14 insertions(+), 10 deletions(-)
diff --git a/index.php b/index.php @@ -24,16 +24,20 @@ $stmt->execute(); $row = mysqli_fetch_assoc($result); - if($gebruikersnaam === $row['medewerker_id'] && password_verify($wachtwoord, $row['wachtwoord'])) - { - session_start(); - $_SESSION['gebruikers_id'] = $gebruikersnaam; - $_SESSION['permissions'] = $row['permissie_niveau']; - header('Location: dashboard.php'); - echo"gebruikers id". $_SESSION['gebruikers_id'] ."permissie niveau " . $_SESSION['permissie_niveau']; - } else { - echo '<p style="color:red">Invalid username or password.</p>'; - } + if(!empty($row)){ + if($gebruikersnaam === $row['medewerker_id'] && password_verify($wachtwoord, $row['wachtwoord'])) + { + session_start(); + $_SESSION['gebruikers_id'] = $gebruikersnaam; + $_SESSION['permissions'] = $row['permissie_niveau']; + header('Location: dashboard.php'); + echo"gebruikers id". $_SESSION['gebruikers_id'] ."permissie niveau " . $_SESSION['permissie_niveau']; + } else { + echo '<p style="color:red">Invalid username or password.</p>'; + } + }else{ + echo '<p style="color:red">Invalid username or password.</p>'; + } } ?> <form method="POST">