diff --git a/src/app.php b/src/app.php index 0bdcc30d18bb88c5e01a038f8c1cc6da37eb56c8..29a67aae09b132f9555677e9d615ae7551c95835 100644 --- a/src/app.php +++ b/src/app.php @@ -18,6 +18,7 @@ class DagoJek { $instance = new DagoJek(); } + include_once 'model/User.php'; $instance->includeAllController(); return $instance; diff --git a/src/controller/LoginController.php b/src/controller/LoginController.php index a0c19d1819b18e0b95bf6f92a6941e4effbda2e1..0dc3c71cf56f73c520cdab27a26b43e909f50c5d 100644 --- a/src/controller/LoginController.php +++ b/src/controller/LoginController.php @@ -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