init comit of php_xcstat on TA-HOPPE
This commit is contained in:
51
www/login.php
Normal file
51
www/login.php
Normal file
@ -0,0 +1,51 @@
|
||||
<?php
|
||||
session_start();
|
||||
$pdo = new PDO('mysql:host=rdbms.strato.de;dbname=dbs9336961', 'dbu1516891', 'C5ZrqVZDDBtv9SfloCh3');
|
||||
|
||||
if(isset($_GET['login']))
|
||||
{
|
||||
$email = $_POST['email'];
|
||||
$passwort = $_POST['passwort'];
|
||||
|
||||
$statement = $pdo->prepare("SELECT * FROM users WHERE email = :email");
|
||||
$result = $statement->execute(array('email' => $email));
|
||||
$user = $statement->fetch();
|
||||
|
||||
//Überprüfung des Passworts
|
||||
if ($user !== false && password_verify($passwort, $user['passwort']))
|
||||
{
|
||||
$_SESSION['userid'] = $user['id'];
|
||||
die('Login erfolgreich. Weiter zu <a href="./geheim.php">internen Bereich</a>');
|
||||
}
|
||||
else
|
||||
{
|
||||
$errorMessage = "E-Mail oder Passwort war ungültig<br>";
|
||||
}
|
||||
|
||||
}
|
||||
?>
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>Login</title>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<?php
|
||||
if(isset($errorMessage))
|
||||
{
|
||||
echo $errorMessage;
|
||||
}
|
||||
?>
|
||||
|
||||
<form action="?login=1" method="post">
|
||||
E-Mail:<br>
|
||||
<input type="email" size="40" maxlength="250" name="email"><br><br>
|
||||
|
||||
Dein Passwort:<br>
|
||||
<input type="password" size="40" maxlength="250" name="passwort"><br>
|
||||
|
||||
<input type="submit" value="Abschicken">
|
||||
</form>
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user