Advertisement
alza

Untitled

Feb 25th, 2016
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.87 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. session_start();
  15. $azabu = mysql_query("select * from users where username='$username' and password='$password'");
  16. if $select = mysql_fetch_array(mysql_query("select * from users where username='$username' and password='$password'"));
  17.  
  18. $_SESSION['username'] = $username;
  19.  
  20. if($select["level"] == 1){
  21.  
  22. header('location:halaman_admin.php');
  23.  
  24. }else if($select["level"] == 2){
  25.  
  26. header('location:halaman_user.php');
  27.  
  28. }else{
  29.  
  30. header('location:halaman_login.php');
  31.  
  32. }
  33. }
  34.  
  35.  
  36. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement