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

Added login page. Still using mock data though.

parent 49f636bd
No related merge requests found
<?php
/**
* Created by PhpStorm.
* User: iqbal
* Date: 04/10/17
* Time: 16:29
*/
session_start();
$userData = array(
"iqbal" => "test",
"test" => "pass"
);
if (isset($_GET['logout'])) {
$_SESSION['username'] = "";
header("Location: ../view/login.html");
exit;
}
if (isset($_POST['username'])) {
if ($userData[$_POST['username']] === $_POST['password']) {
$_SESSION['username'] = $_POST['username'];
echo "<script> alert('Login berhasil') </script>";
} else {
echo "<script> alert('Username atau password salah') </script>";
}
}
\ No newline at end of file
......@@ -3,7 +3,8 @@
class MainController {
public static function LoginHandler() {
echo "This is login handler";
header("Location: http://dagojek.com/src/view/login.html");
die();
}
public static function DefaultHandler() {
......
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Login Page | Dagojek</title>
<link rel="stylesheet" type="text/css" href="style.css">
</head>
<body id="login-body">
<div class="container">
<header id="login-header">
<h1>Dagojek Login</h1>
</header>
<section id="login-main">
<div id="login-panel">
<form name="loginForm" method="post" action="../controller/LoginController.php">
<fieldset>
<legend>Login:</legend>
Username: <br>
<input type="text" placeholder="Username" name="username">
<br>
Password: <br>
<input type="password" placeholder="Password" name="password">
<br>
<input type="submit" value="Login">
<a id="register-link" href="register.html">Don't have an account?</a>
<br>
</fieldset>
</form>
</div>
</section>
<footer>
</footer>
</div>
</body>
</html>
\ No newline at end of file
#login-body, #register-body {
background-color: #333333;
color: #ffffff;
}
#login-header, #register-header {
text-align: center;
margin-top: 50px;
}
#login-main, #register-main {
horiz-align: center;
width: 25%;
height: 60%;
margin: 0 auto;
}
#register-link {
float: right;
color: #f4df42;
margin-top: 0.3em;
}
.available {
background-color: greenyellow;
}
.unavailable {
background-color: orangered;
}
input {
margin-top: 5px;
margin-bottom: 5px;
}
\ 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