Weird session problem
Posted: Sun Mar 21, 2010 10:09 pm
I'm making a small website where an admin has special functions. I've managed to make my login/logout scripts with sessions and able to show the admin's special functions only to him.
The problem is when logging out and back in, it gets really weird. This is how I can come accross the error:
1. Enter my website
2. Log-in as 'admin'
3. Click on Add News (the special functions)
4. At this point, things work perfect, I can add news and go back to main page.
5. Log-out
6. Log-in as 'admin' again
7. Click on Add News
8. At this point, I get logged out and can't add news obviously until I log in again.
This is how I perform log-out
This is the actual log out function
Am I doing the logout wrong? I need to know if that part is ok so I can look for errors elsewhere.
Thanks in advance,
etonB.
The problem is when logging out and back in, it gets really weird. This is how I can come accross the error:
1. Enter my website
2. Log-in as 'admin'
3. Click on Add News (the special functions)
4. At this point, things work perfect, I can add news and go back to main page.
5. Log-out
6. Log-in as 'admin' again
7. Click on Add News
8. At this point, I get logged out and can't add news obviously until I log in again.
This is how I perform log-out
Code: Select all
<p class="textoIngresar">Welcome, <?php echo $_SESSION["loggedUser"];?> ( <a href="index.php?action=logout">Log-out</a> )</p>Code: Select all
if ( $_GET["action"] == "logout")
{
session_unset();
session_destroy();
}Thanks in advance,
etonB.