Advertisement
alza

Untitled

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