Advertisement
Guest User

Untitled

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