Renaming everything to english. #9
10
login.php
10
login.php
@ -4,18 +4,18 @@ $pdo = new PDO('mysql:host=localhost;dbname=usertable', 'usertable', 'password')
|
|||||||
|
|
||||||
if(isset($_GET['login'])) {
|
if(isset($_GET['login'])) {
|
||||||
$email = $_POST['email'];
|
$email = $_POST['email'];
|
||||||
$passwort = $_POST['passwort'];
|
$password = $_POST['password'];
|
||||||
|
|
||||||
$statement = $pdo->prepare("SELECT * FROM users WHERE email = :email");
|
$statement = $pdo->prepare("SELECT * FROM users WHERE email = :email");
|
||||||
$result = $statement->execute(array('email' => $email));
|
$result = $statement->execute(array('email' => $email));
|
||||||
$user = $statement->fetch();
|
$user = $statement->fetch();
|
||||||
|
|
||||||
//Überprüfung des Passworts
|
//Überprüfung des Passworts
|
||||||
if ($user !== false && password_verify($passwort, $user['passwort'])) {
|
if ($user !== false && password_verify($password, $user['password'])) {
|
||||||
$_SESSION['userid'] = $user['id'];
|
$_SESSION['userid'] = $user['id'];
|
||||||
$_SESSION['email'] = $user['email'];
|
$_SESSION['email'] = $user['email'];
|
||||||
$_SESSION['givenName'] = $user['vorname'];
|
$_SESSION['givenName'] = $user['givenName'];
|
||||||
$_SESSION['lastName'] = $user['nachname'];
|
$_SESSION['lastName'] = $user['lastName'];
|
||||||
die('successfull. go to: <a href="secure.php">secure page</a>');
|
die('successfull. go to: <a href="secure.php">secure page</a>');
|
||||||
} else {
|
} else {
|
||||||
$errorMessage = "somethings wrong (maybe wrong password or wrong email)<br>";
|
$errorMessage = "somethings wrong (maybe wrong password or wrong email)<br>";
|
||||||
@ -41,7 +41,7 @@ E-Mail:<br>
|
|||||||
<input type="email" size="40" maxlength="250" name="email"><br><br>
|
<input type="email" size="40" maxlength="250" name="email"><br><br>
|
||||||
|
|
||||||
Your password:<br>
|
Your password:<br>
|
||||||
<input type="password" size="40" name="passwort"><br>
|
<input type="password" size="40" name="password"><br>
|
||||||
|
|
||||||
<input type="submit" value="GO">
|
<input type="submit" value="GO">
|
||||||
</form>
|
</form>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user