diff --git a/login.php b/login.php index da4010d..2eadbfe 100644 --- a/login.php +++ b/login.php @@ -13,6 +13,9 @@ if(isset($_GET['login'])) { //Überprüfung des Passworts if ($user !== false && password_verify($passwort, $user['passwort'])) { $_SESSION['userid'] = $user['id']; + $_SESSION['email'] = $user['email']; + $_SESSION['giveName'] = $user['vorname']; + $_SESSION['lastName'] = $user['nachname']; die('successfull. go to: secure page'); } else { $errorMessage = "somethings wrong (maybe wrong password or wrong email)
"; diff --git a/register.php b/register.php index c0d4507..19b9bb0 100644 --- a/register.php +++ b/register.php @@ -15,6 +15,8 @@ $showFormular = true; if(isset($_GET['register'])) { $error = false; $email = $_POST['email']; + $givenName = $_POST['vorname']; + $lastName = $_POST['nachname']; $passwort = $_POST['passwort']; $passwort_confirm = $_POST['passwort_confirm']; @@ -46,7 +48,7 @@ if(isset($_GET['register'])) { if(!$error) { $passwort_hash = password_hash($passwort, PASSWORD_DEFAULT); - $statement = $pdo->prepare("INSERT INTO users (email, passwort) VALUES (:email, :passwort)"); + $statement = $pdo->prepare("INSERT INTO users (email, vorname, nachname, passwort) VALUES (:email, :vorname, :nachname, :passwort)"); $result = $statement->execute(array('email' => $email, 'passwort' => $passwort_hash)); if($result) { @@ -64,7 +66,10 @@ if($showFormular) {
E-Mail:


- +Given Name:
+

+Family Name:
+

Password:

diff --git a/secure.php b/secure.php index d819335..374aecf 100644 --- a/secure.php +++ b/secure.php @@ -6,19 +6,19 @@ if(!isset($_SESSION['userid'])) { } $userid = $_SESSION['userid']; +$useremail = $_SESSION['email']; +$usergn = $_SESSION['givenName']; +$userln = $_SESSION['lastName']; -echo "Hi ".$userid; +echo "Hi ".$usergn; +echo "
"; +echo "Your User-ID is: ".$userid; +echo "
"; +echo "Your full name is: ".$usergn." ".$userln; +echo "
"; +echo "And your email is: ".$useremail; echo "
"; echo "
"; -echo "
"; -$statement = $pdo->prepare("SELECT * FROM users WHERE id = $userid"); - $result = $statement->execute(array('email' => $email)); - $user = $statement->fetch(); - -echo $email; -echo "
"; -echo "
"; -echo "
"; - -echo "This is secure now!"; +echo "This is the end now!"; +echo "goodbye"; ?>