i used session_start() to start someone's, so that variables could be carried from page to page.
How do I end the session that session_start() started for a specific computer?
Thanks
Jim
| SitePoint Sponsor |
i used session_start() to start someone's, so that variables could be carried from page to page.
How do I end the session that session_start() started for a specific computer?
Thanks
Jim
got it covered
i was using session_destroy() incorrectly beforeit works now with about a 5 line logout script.....wow, i love PHP, and i've only known it for about 3 days. its a beautiful thing
![]()





Really? I thought the only way to end a session is to close your browser!





your kidding, right?
yes i was tempted to post something like that... you ARE kidding aren't you...i may be new to PHP but from what i've read so far that pretty much allows you to end a session without closing your browser



Actually, session_destroy unsets the current session, but it doesn't unset any variables. So, if you call session_destroy, it will not affect the immediate page. You need to wait for the next page, before you can see the effect of session_destroy()
First Million Challenge - Blog Challenge To Make My First Million
Active-Income.com | Active Jokes | Active-Freebies.com | Active Free Stuff
i don't know the extent of which it "kills" the session, but I was having this problem before that I would log in as one user correctly, but then If I tried to log in as another right off the bat, it would take me to the edit page under the old username.
But using session_destroy() it lets me change usernames.....serves my purposes
does anyone know how I can set the life of a cookie in .htaccess!?
Thanks
Jim





you don't set a cookie's life in .htaccess, you set it when you make a cookie.





I'm not kidding. I posted the problem in this thread (the one next to the last post)
http://www.sitepointforums.com/showt...threadid=34674
and no one correct me.
but session_start() automatically creates my cookie, correct?
How do I use session start and still be able to set the cookie time?
Thanks
Jim





session_start() does create a cookie, but only if cookies are set to on in php.ini, but it only stores the session id in the cookie.
You can also use the SID in the url to keep the session.
Bookmarks