who can help me with, this is the code:
<?php
session_start();
if(isset($_SESSION['user_id'])){
header('Location: index.php');
}
require 'database.php';
$error='';
if(!empty($_POST['username']) && !empty($_POST['password'])):
$records = $conn->prepare('SELECT id,name,surname,username,password FROM users WHERE username =:username');
$records->bindValue(':username', $_POST['username']);
$records->execute();
$results = $records->fetch(PDO::FETCH_ASSOC);
if(count($results) > 0 && password_verify($_POST['password'], $results['password']) ){
$_SESSION['user_id'] = $results['id'];
$_SEESION['user_name'] = $results['name'];
$_SEESION['user_surname'] = $results['surname'];
header('Location: index.php');
}else{
$error = 'Na vjen keq, username ose passowrd jane gabim !!';
}
endif;
?>
the session user_id is saved normally and i can use it, but two other sessions user_name and user_surname are not beign saved, when i try to use them i get an error saying undefined 'user_name' and 'user_surname'
Aucun commentaire:
Enregistrer un commentaire