Advertisement
Guest User

Untitled

a guest
Jan 24th, 2018
59
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.28 KB | None | 0 0
  1. <?php
  2. if(isset($_POST['username'], $_POST['password'])){
  3. $username = htmlspecialchars($_POST['username']);
  4. $password = password_hash(htmlspecialchars($_POST['password']), PASSWORD_DEFAULT);
  5.  
  6.  
  7. $login_statetment = $pdo->prepare("SELECT * FROM user_users WHERE username LIKE :username OR email LIKE :username");
  8. $login_statetment->bindParam("username", $username);
  9. $login_statetment->execute();
  10. $user = $login_statetment->fetch();
  11.  
  12. if($user != null) {
  13. if(isset($_SESSION)){
  14. session_start();
  15. }
  16. $_SESSION['username'] = $user['username'];
  17. header("Location: ?a=loggedin");
  18. } else {
  19. echo ('<div class="alert alert-danger" role="alert">Deine Passwörter stimmen nicht überein!</div>');
  20. }
  21. }
  22.  
  23. ?>
  24. <form class="col-md-6 offset-md-3" method="post" action="?p=login">
  25. <div class="form-group">
  26. <label>Benutzername oder Email</label>
  27. <input type="text" class="form-control" name="username" required >
  28. </div>
  29. <form class="col-md-6 offset-md-3">
  30. <div class="form-group">
  31. <label>Passwort</label>
  32. <input type="password" class="form-control" name="email" required >
  33. </div>
  34. <form class="col-md-6 offset-md-3">
  35. <div class="form-group">
  36. <input type="submit" class="btn btn-outline-primary" value="Anmelden">
  37. </div>
  38. </form>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement