Skip to content
Snippets Groups Projects
Commit d1bb2ab8 authored by Iqbal's avatar Iqbal
Browse files

Fixed login functionality.

parent bdc0efea
No related merge requests found
......@@ -18,6 +18,7 @@ class DagoJek {
$instance = new DagoJek();
}
include_once 'model/User.php';
$instance->includeAllController();
return $instance;
......
......@@ -8,8 +8,11 @@
session_start();
$dbconn = DB::getInstance();
$userData = User::GetAllUsernameAndPassword($dbconn);
include_once "Controller.php";
include_once "../model/User.php";
$pdo = DB::getInstance();
$userData = User::GetAllUsernameAndPassword($pdo);
if (isset($_GET['logout'])) {
$_SESSION['username'] = "";
......@@ -20,8 +23,8 @@
if (isset($_POST['username'])) {
if ($userData[$_POST['username']] === $_POST['password']) {
$_SESSION['username'] = $_POST['username'];
echo "<script> alert('Login berhasil') </script>";
echo "<script type='application/javascript'> alert('Login berhasil'); </script>";
} else {
echo "<script> alert('Username atau password salah') </script>";
echo "<script type='application/javascript'> alert('Username atau password salah'); </script>";
}
}
\ No newline at end of file
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment