I know that this topic has been brought up time and time again but I have yet to see it answered so here goes...
after calling a page with only:
session_start();
then linking to logout page that contained a call to:
session destroy();
I got the following error:
Warning: Trying to destroy uninitialized session in c:\my documents\my webs\active\htdocs\logout.php on line 3
logged out
So I figured you need to call session_start() on the page you are calling session_destroy() even though you are not using any of the session variables, so I did with the following:
session_start();
session_destroy();
I got the following error:
Warning: Session object destruction failed in c:\my documents\my webs\active\htdocs\logout.php on line 3
logged out
I have some questions as a result of this
1) if a session exists that you wish to destroy does session_start have to be called on the same page?
2) what am I doing wrong in the above examples? Am I doing something wrong in the above examples? Are sessions "broken" as many people commented or is there a fix available?
NOTE: I am using php 4 with apache on a win me box
3) The concept of sessions is easy enough to understand but I am having problems finding examples that are complete or use sessions in a realistic way ie. spanning multiple pages storing the session data in a database and with garbage collection working. Any ideas where I may find such an example or reasonable peices of?
Thanks for the help.
PS - I have been programming for some time but am fairly green when it comes to web programming and even greener when it comes to open source stuff. I have to say I was blown away. It's hard to beleive how supportive everyone is and what a strong sense of community there is.