This is my login.php code :
session_start();
ob_start ();
$_SESSION['login'] = "login";
header('Location: http://www.domain.com/folder/home.php');
exit();
This is my home.php code :
session_start();
ob_start ();
if (!isset($_SESSION['login']))
{
header('Location: http://www.domain.com/folder/login.php');
exit();
}
The problem is when I login the first time, it goes to home.php
and redirect back to login.php
. When I login again, it doesn't redirect me to login.php again.
I see the flow using Firefox Developer Toolbar.
I've used var_dump($_SESSION)
to see any whether the session is set. It returns array(0)
.
Is there any problem with this codes? or is it because of any other problems ?
Thanks :D