Skip to content
Snippets Groups Projects
index.php 1.46 KiB
Newer Older
<?php
	include "../model/user.php";
	if($_SERVER["REQUEST_METHOD"] == "POST") {
		$user = new User;
		$result = $user->getUserByLogIn($_POST['username'], $_POST['password']);
		$count = mysqli_num_rows($result);
		$result = $result->fetch_assoc();
		if($count == 1) {
			if ($result['isDriver']) {
				header("location:dashboard.php?id=" . $result["id"]);
			} else {
				header("location:dashboard.php?id=" . $result["id"]);
			}
		} else {
			echo "<script>alert('Username dan/atau password yang anda masukkan salah.')</script>";
		}
	}
?>
	<head>
		<title>Projekers - Login</title>
		<link rel = "stylesheet" href = "../css/primary.css">
		<link rel = "stylesheet" href = "../css/index.css">
	</head>
	<body>
		<div class = "container">
			<div class="logo">
                <hr class="line">
                LOGIN
                <hr class="line">
			</div>
			<div class = "form_input">
				<form method="POST">
					<div class="set">
						<div class="label">Username</div>
						<div class="field"><input type="text" name="username"></div>
					</div>
					
					<div class="set">
						<div class="label">Password</div>
						<div class="field"><input type="password" name="password"></div>
					</div>
					
					<div class="linkset">
						<div class="link"><a href="register.php">Don't have an account?</a></div>
						<div class="submitbutton">
							<input type = "Submit" value = "GO!" class = "submit">
						</div>
					</div>
				</form>
			</div>
		</div>
	</body>
</html>