Advertisement
Guest User

Untitled

a guest
Oct 28th, 2016
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.60 KB | None | 0 0
  1. <?php
  2. session_start();
  3. $username = $_POST['username'];
  4. $password = $_POST['password'];
  5.  
  6. $_SESSION['username'] = $username;
  7. $_SESSION['password'] = $password;
  8.  
  9. if ($username=="belajar" AND $password=="php"){
  10. header('location: user');
  11. }else{
  12. if (ini_get("session.use_cookies")) {
  13. $params = session_get_cookie_params();
  14. setcookie(session_name(), '', time() - 42000,
  15. $params["path"], $params["domain"],
  16. $params["secure"], $params["httponly"]
  17. );
  18. }
  19. session_destroy();
  20. echo "<script>alert('Username atau password salah!'); document.location.href=\"index.php\"</script>";
  21. }
  22. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement