Guest User

Untitled

a guest
Dec 4th, 2017
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.67 KB | None | 0 0
  1. <?php session_start(); ?>
  2. <!DOCTYPE html>
  3. <html>
  4. <head>
  5. <title>Login</title>
  6. </head>
  7. <body>
  8.  
  9. <form action="" method="post">
  10. <h2>Login here..</h2>
  11. Username : <input type="text" name="user">
  12. <br>
  13. Password : <input type="password" name="pass">
  14. <br>
  15. <input type="submit" name="login" value="Login">
  16. </form>
  17.  
  18. <?php
  19.  
  20. if(isset($_POST['login'])){
  21. $user = $_POST['user'];
  22. $pass = $_POST['pass'];
  23.  
  24. echo $_POST['user'];
  25.  
  26. //- periksa login
  27. if($user == "admin" && $pass == "1234"){
  28. $_SESSION["login"] = $user;
  29. //- menuju ke halaman selanjutnya
  30. echo "<h1>Anda berhasil LOGIN</h1>";
  31. echo "<h2>Klik <a href='session2.php'> di sini (session2.php) </h2>";
  32. }
  33. }
  34.  
  35. ?>
  36.  
  37. </body>
  38. </html>
Add Comment
Please, Sign In to add comment