Guest User

Untitled

a guest
Sep 12th, 2018
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.72 KB | None | 0 0
  1. <?php
  2. require_once 'config.inc.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. $query = "SELECT * FROM users
  12. WHERE username = '$username'
  13. AND password = '$password'";
  14.  
  15. $result = mysqli_query($mysqli, $query);
  16.  
  17. if (mysqli_num_rows($result) == 1) {
  18. session_start();
  19.  
  20. $_SESSION['username'] = $username;
  21. header("location:home.php");
  22. } else {
  23. header("location:index.php");
  24. exit;
  25. }
  26. } else {
  27. echo "Niet alle velden zijn ingevuld!";
  28. exit;
  29. }
  30. ?>
Add Comment
Please, Sign In to add comment