So I have a log in php file ,where after it checks if the username and password correct, it redirects to main page. The point is I want to remember which user it is, so it will be his session only.
that's log in part:
if(mysql_num_rows($result) > 0)
{
session_start();
$_SESSION['username'] = $username;
$_SESSION['password'] = $password;
header('Location: ../Main_page/main_page.php');
}
So now on main page I use:
<?php
$user = $_SESSION['username'];
?>
and after I while if I want for example to output user name, I wanted to use for example :
<dt>Welcome, <em><?php echo $_SESSION['username']?></em></dt>
But it doesn't work... Please help me to find error in this code