Advertisement
Guest User

Untitled

a guest
May 25th, 2016
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.94 KB | None | 0 0
  1. //check connection to database
  2. if (mysqli_connect_errno())
  3. {
  4. echo "Failed to connect to MySQL: " . mysqli_connect_error();
  5. }
  6.  
  7. // Perform queries
  8.  
  9. $sql = mysqli_query("SELECT * FROM tbl_users WHERE username='$name' AND password='$password'");
  10. echo mysqli_num_rows($sql);
  11.  
  12.  
  13. if(mysqli_num_rows($sql)==1){
  14. session_start();
  15. $data = mysqli_fetch_array($sql);
  16. $_SESSION['id'] = $data['id_user'];
  17. $_SESSION['username'] = $data['username'];
  18. $_SESSION['password'] = $data['password'];
  19. echo "Proses Login";
  20. print "<html><head><meta http-equiv='refresh' content='1; URL=admin/index.php'</meta></head></html>";
  21. }
  22. else {
  23. echo "Login Denied";
  24. print "<html><head><meta http-equiv='refresh' content='1; URL=admin/index2.php'</meta></head></html>";
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement