introducing update.php & a new session variable
This commit is contained in:
		@@ -18,6 +18,7 @@ if(isset($_GET['login'])) {
 | 
			
		||||
        $_SESSION['givenName'] = $user['givenName'];
 | 
			
		||||
        $_SESSION['lastName'] = $user['lastName'];
 | 
			
		||||
        $_SESSION['activated'] = $user['activated'];
 | 
			
		||||
        $_SESSION['updated_at'] = $user['updated_at'];
 | 
			
		||||
        die('<div class="alert alert-success" role="alert"> successfull. go to: <a href="secure.php">secure page</a></div> <meta http-equiv="refresh" content="0; URL=secure.php">');
 | 
			
		||||
    } else {
 | 
			
		||||
        $errorMessage = '<div class="alert alert-danger" role="alert">somethings wrong (maybe wrong password or wrong user)</div><br>';
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										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