Guest User

Untitled

a guest
Aug 18th, 2018
109
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.63 KB | None | 0 0
  1. if (isset($_POST['login_user'])) {
  2. $username = mysqli_real_escape_string($db, $_POST['username']);
  3. $password = mysqli_real_escape_string($db, $_POST['password']);
  4.  
  5. ..
  6.  
  7. if (count($errors) == 0) {
  8. $password = md5($password);
  9. $query = "SELECT * FROM users WHERE username='$username' AND password='$password'";
  10. $results = mysqli_query($db, $query);
  11. if (mysqli_num_rows($results) == 1) {
  12. $_SESSION['username'] = $username;
  13. $_SESSION['success'] = "You are now logged in";
  14. header('location: ../sip/index.php');
  15. }else {
  16. array_push($errors, "Wrong username/password combination");
  17. }
  18. }
  19. }
Add Comment
Please, Sign In to add comment