Page 1 of 1

session_destroy requires two pages?

Posted: Tue Sep 23, 2008 6:18 am
by JAB Creations
I originally had the problem of Warning: Trying to destroy uninitialized session so I changed my code to the following...

header.php

Code: Select all

session_name("member");
session_start();
if (isset($_GET['signout'])) {session_destroy();}
...now when I load another page the user is still signed in until the second page after signing out.

I'm just trying to make this dead simple: page 1 + signed in == page 2 appears signed in. Page 2 + sign out == page 3 == appears signed out.

I've been messing with sessions for so long though only this morning decided to add a sign out link. :mrgreen:

Re: session_destroy requires two pages?

Posted: Tue Sep 23, 2008 8:08 am
by Maugrim_The_Reaper
Have forced $_SESSION to an empty array and deleted the client side cookie?

Re: session_destroy requires two pages?

Posted: Tue Sep 23, 2008 9:14 am
by JAB Creations
We lost our internet connection here because a family member hasn't paid the bill and Comcast is shutting it off at the exact moment it's due (won't have internet until tomorrow so...) I tried that according to a book to do that and I'm copying the php.net page for the destroy session function.

I also tried unsetting the $_SESSION['member'] variable and then destroying the session and that also did not work. I know that is the only variable that I have set. Not sure if I'll have net access for the rest of the day so if I don't reply you guys know why. :|

Re: session_destroy requires two pages?

Posted: Tue Sep 23, 2008 4:27 pm
by JAB Creations
I got it working though not dynamically...I'll have to give it another crack sometime. Oh and my internet is back...family. :roll: =