print email address of user(?)

This commit is contained in:
Thies Mueller 2021-01-08 13:31:41 +01:00
parent 173c258b00
commit 4b8d3dc9ea

View File

@ -1,5 +1,6 @@
<?php <?php
session_start(); session_start();
$pdo = new PDO('mysql:host=localhost;dbname=usertable', 'usertable', 'password');
if(!isset($_SESSION['userid'])) { if(!isset($_SESSION['userid'])) {
die('Please <a href="login.php">login</a>'); die('Please <a href="login.php">login</a>');
} }
@ -8,5 +9,16 @@ $userid = $_SESSION['userid'];
echo "Hi ".$userid; echo "Hi ".$userid;
echo "<br/>"; echo "<br/>";
echo "<br/>";
echo "<br/>";
$statement = $pdo->prepare("SELECT * FROM users WHERE id = $userid");
$result = $statement->execute(array('email' => $email));
$user = $statement->fetch();
echo $email;
echo "<br/>";
echo "<br/>";
echo "<br/>";
echo "This is secure now!"; echo "This is secure now!";
?> ?>