Advertisement
Guest User

Untitled

a guest
Sep 16th, 2018
106
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.90 KB | None | 0 0
  1. <?php
  2. require_once 'config.inc2.php';
  3.  
  4. $username = $_POST['username'];
  5. $password = $_POST['password'];
  6.  
  7. if (strlen($username) > 0 && strlen($password) > 0) {
  8.  
  9. $password = md5($password);
  10.  
  11. $stmt = $mysqli->prepare('SELECT username, password FROM users WHERE username = ? and password = ?');
  12. $stmt->bind_param("ss", $username,$password);
  13.  
  14.  
  15. $stmt->execute();
  16.  
  17. $stmt->bind_result($pizza);
  18. $result = $stmt->fetch();
  19. var_dump($result);
  20. //var_dump($result);
  21.  
  22. var_dump($stmt->rowCount());
  23. if ($stmt->rowCount() === 1) {
  24. session_start();
  25.  
  26. $_SESSION['username'] = $username;
  27. header("location:home.php");
  28. } else {
  29. header("location:index.php");
  30. exit;
  31. }
  32. } else {
  33. echo "Niet alle velden zijn ingevuld!";
  34. exit;
  35. }
  36. $stmt->close();
  37. $pdo->close();
  38. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement