Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- if(isset($_POST['username'], $_POST['password'])){
- $username = htmlspecialchars($_POST['username']);
- $password = password_hash(htmlspecialchars($_POST['password']), PASSWORD_DEFAULT);
- $login_statetment = $pdo->prepare("SELECT * FROM user_users WHERE username LIKE :username OR email LIKE :username");
- $login_statetment->bindParam("username", $username);
- $login_statetment->execute();
- $user = $login_statetment->fetch();
- if($user != null) {
- if(isset($_SESSION)){
- session_start();
- }
- $_SESSION['username'] = $user['username'];
- header("Location: ?a=loggedin");
- } else {
- echo ('<div class="alert alert-danger" role="alert">Deine Passwörter stimmen nicht überein!</div>');
- }
- }
- ?>
- <form class="col-md-6 offset-md-3" method="post" action="?p=login">
- <div>
- <label>Benutzername oder Email</label>
- <input type="text" class="form-control" name="username" required >
- </div>
- <div class="form-group">
- <label>Passwort</label>
- <input type="password" class="form-control" name="email" required >
- </div>
- <div class="form-group">
- <input type="submit" class="btn btn-outline-primary" value="Anmelden">
- </div>
- </form>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement