Advertisement
Guest User

login_proses

a guest
May 22nd, 2016
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.82 KB | None | 0 0
  1. <?php
  2. include "koneksi.php";
  3. $username = $_POST['username'];
  4. $password = $_POST['password'];
  5.  
  6. if (empty($username)) {
  7. echo "<script>alert('Username cannot be empty.')</script>";
  8. echo "<meta http-equiv='refresh' content='1 url=login.php'>";
  9. }
  10.  
  11. else if (empty($password)){
  12. echo "<script>alert('Password cannot be empty.')</script>";
  13. echo "<meta http-equiv='refresh' content='1 url=login.php'>";
  14. }
  15.  
  16. else {
  17. session_start();
  18. $login = mysql_query("select * from users where username='$username' and password='$password'");
  19.  
  20. if (mysql_num_rows($login) > 0) {
  21. $_SESSION['username'] = $username;
  22. header["Location : library/HTML/HOMEmember.php"];
  23. }
  24.  
  25. else {
  26. echo "<script>alert('Username or Password is incorrect.')</script>";
  27. echo "<meta http-equiv='refresh' content='1 url=login.php'>";
  28. }
  29. }
  30. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement