<?php require_once 'inc/functions.php'; session_start(); if (!empty($_POST) and !empty($_POST['username']) and !empty($_POST['password'])) { require_once 'inc/db.php'; // Ansuchen der gegebenen Benutzername im Datenbank $req = $pdo->prepare("SELECT * FROM users WHERE username = ? AND confirmed_at IS NOT NULL"); $req->execute([$_POST['username']]); $ident = $req->rowCount(); $user = $req->fetch(); if ($ident == 1 and password_Verify($_POST['password'], $user->password)) { $_SESSION['authentification'] = $user; $_SESSION['flash']['success'] = "Sie sind jetzt angemeldet !"; header('Location: ./account.php'); exit; } else { $_SESSION['flash']['danger'] = "Ungültiger Benutzername oder falsches Passwort !"; } } ?> <!DOCTYPE html> <html> <head> <title> Registrieren </title> <meta charset = "utf-8/"> <link rel = "stylesheet" href="css/style-inscription.css" type="text/css"> </head> <body>
<?php include "./includes/base.php"; include "./includes/header.php"; $username = mysql_real_escape_string($_POST['username']); $password = mysql_real_escape_string($_POST['password']); if (!empty($_SESSION['Username']) && !empty($_SESSION['LoggedIn'])) { echo "Member Area"; ?> <a href="./dashboard.php">dashboard</a> <?php } elseif (!empty($_POST['username']) && !empty($_POST['password'])) { $result = $connection->query("SELECT * FROM users WHERE Username = '******'"); $row = $result->fetch_array(MYSQLI_ASSOC); $hash = $row['Password']; if (password_Verify($password, $hash)) { $_SESSION['Username'] = $username; $_SESSION['LoggedIn'] = 1; echo "Success"; echo "Welcome " . $_SESSION['Username'] . " !"; ?> Member area <a href="./dashboard.php">dashboard</a> <?php } else { ?> <body onload="loginMarginSet()"> <div id="login-form-wrapper"> <div id="right-login"> <div id="login-form" class="center"> <span class="logo-part-one">elements</span><br><br>