Advertisement
Guest User

Untitled

a guest
Mar 13th, 2017
103
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.99 KB | None | 0 0
  1. <?php
  2. //is er gepost
  3. if(!empty($_POST)){
  4. //is alles ingevuld
  5. if(!empty($_POST['email']) && !empty($_POST['password'])){
  6. //email + sh1(wachtwoord + salt) gevonden wordt in database
  7. $email = $_POST['email'];
  8. $password = $_POST['password'];
  9.  
  10. $conn = new mysqli("localhost", "root", "", "phples");
  11.  
  12. $query = "SELECT * FROM `users`
  13. WHERE (email = '". $conn->real_escape_string($email) ."');";
  14.  
  15. $result = $conn->query($query);
  16.  
  17. $user = $result->fetch_assoc();
  18.  
  19. if(password_verify($password, $user['password'])){
  20. //OK
  21. session_start();
  22. $_SESSION['user'] = $email;
  23. header('Location: loggedin.php');
  24. echo "ok";
  25. }else{
  26. //NIET OK
  27.  
  28. }
  29. }
  30. }
  31.  
  32. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement