- session_start: documentation ( source)
- header: documentation ( source)
<?php
session_start();
include_once 'include/validasiUser.php';
$user = new User();
if ($user->get_session())
{
header("location:proses.php");
}
if ($_SERVER["REQUEST_METHOD"] == "POST") {
$login = $user->check_login($_POST['emailusername'], $_POST['password']);
if ($login) {
// Login Berhasil
header("location:index.php");
} else {
// Login Gagal
echo '<center><b>Maaf, Email atau password yang anda masukkan <u>salah</u></b></center>';
}
}
?>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>FORM LOGIN</title>
<style>
body
{
font-family:Arial, Helvetica, sans-serif;
}
</style>
</head>
<body>
<div id="container"><center>
<div id="main-body">
<br/><br/>
<form method="POST" action="" id="login_form" name="login">
<div class="head">
<b> LOGIN DISINI,<br><i>Email = afayuraputra@gmail.com</i> dan <i>Password = 115060800111025</i></b><br/><br/>
</div>
<label>Email </label><br/>
<input type="text" name="emailusername" required="true"/><br/> <br/>
<label>Password</label><br/>
<input type="password" name="password" id="password" required="true"/><br/><br/>
<input type="hidden" name="flag" value="login"/>
<input type="submit" name="login_btn" onclick="return( submitregistration());" value="Login"/><br/><br/>
</form>
</div>
</center>
</div>
</body>
</html>