introducing update.php & a new session variable
This commit is contained in:
18
update.php
Normal file
18
update.php
Normal file
@@ -0,0 +1,18 @@
|
||||
<?php
|
||||
session_start();
|
||||
$pdo = new PDO('mysql:host=localhost;dbname=usertable', 'usertable', 'password');
|
||||
$username = $_SESSION['username'];
|
||||
|
||||
$statement = $pdo->prepare("SELECT * FROM users WHERE username = :username");
|
||||
$result = $statement->execute(array('username' => $username));
|
||||
$user = $statement->fetch();
|
||||
$_SESSION['userid'] = $user['id'];
|
||||
$_SESSION['email'] = $user['email'];
|
||||
$_SESSION['username'] = $user['username'];
|
||||
$_SESSION['givenName'] = $user['givenName'];
|
||||
$_SESSION['lastName'] = $user['lastName'];
|
||||
$_SESSION['activated'] = $user['activated'];
|
||||
$_SESSION['updated_at'] = $user['updated_at'];
|
||||
|
||||
echo '<Session newly validated. Going back to secure land! <meta http-equiv="refresh" content="1; URL=secure.php">';
|
||||
?>
|
Reference in New Issue
Block a user