Created
December 2, 2017 09:11
-
-
Save ridoansaleh/cd34c4ba07b53cdd1d8776fae7508dad to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php session_start(); ?> | |
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>Login</title> | |
</head> | |
<body> | |
<form action="" method="post"> | |
<h2>Login here..</h2> | |
Username : <input type="text" name="user"> | |
<br> | |
Password : <input type="password" name="pass"> | |
<br> | |
<input type="submit" name="login" value="Login"> | |
</form> | |
<?php | |
if(isset($_POST['login'])){ | |
$user = $_POST['user']; | |
$pass = $_POST['pass']; | |
echo $_POST['user']; | |
//- periksa login | |
if($user == "admin" && $pass == "1234"){ | |
$_SESSION["login"] = $user; | |
//- menuju ke halaman selanjutnya | |
echo "<h1>Anda berhasil LOGIN</h1>"; | |
echo "<h2>Klik <a href='session2.php'> di sini (session2.php) </h2>"; | |
} | |
} | |
?> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment