Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

PHP Forum


You are currently viewing our PHP Forum as a guest. Please register to participate.
Login



Freelance Jobs

Reply
Question about Sessions
Old 10-15-2010, 06:54 AM Question about Sessions
TWD
TWD's Avatar
King Spam Talker

Posts: 1,190
Trades: 0
Is it really necessary to empty the Session array
before using

session_destroy();

PHP textbooks seem to recommend it without explaining why.
__________________
RATE-MY-WEBSITE.com "Free website reviews by real web professionals"
Please login or register to view this content. Registration is FREE
TWD is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 10-15-2010, 07:27 AM Re: Question about Sessions
captkrackerjack's Avatar
Experienced Talker

Latest Blog Post:
Moved Blog to NGINX!
Posts: 31
Name: Greg
Location: California
Trades: 0
I think this will answer your question, Php.Net session_destroy Manual. The first part of the article states what you question is implying. Let me know if you still need help with it.
__________________

Please login or register to view this content. Registration is FREE

Fav sites; last.fm, mashable.com, speckyboy.com
captkrackerjack is offline
Reply With Quote
View Public Profile Visit captkrackerjack's homepage!
 
Old 10-15-2010, 10:17 AM Re: Question about Sessions
TWD
TWD's Avatar
King Spam Talker

Posts: 1,190
Trades: 0
Quote:
Originally Posted by captkrackerjack View Post
I think this will answer your question, Php.Net session_destroy Manual. The first part of the article states what you question is implying. Let me know if you still need help with it.
Implying?

No, doesnt really help.
__________________
RATE-MY-WEBSITE.com "Free website reviews by real web professionals"
Please login or register to view this content. Registration is FREE
TWD is offline
Reply With Quote
View Public Profile
 
Old 10-15-2010, 11:23 AM Re: Question about Sessions
captkrackerjack's Avatar
Experienced Talker

Latest Blog Post:
Moved Blog to NGINX!
Posts: 31
Name: Greg
Location: California
Trades: 0
Quote:
session_destroy() destroys all of the data associated with the current session. It does not unset any of the global variables associated with the session, or unset the session cookie. To use the session variables again, session_start() has to be called.
So pretty much using session_destroy() will not empty global variables. Emptying the session before destroying ensures that the session is completely destroyed, including the globals, while not a requirement it will free up those resources associated with the session.

Sorry if I came off condescending I just thought that the PHP.net manual page is really great for solving the issue presented
__________________

Please login or register to view this content. Registration is FREE

Fav sites; last.fm, mashable.com, speckyboy.com
captkrackerjack is offline
Reply With Quote
View Public Profile Visit captkrackerjack's homepage!
 
Old 10-15-2010, 08:17 PM Re: Question about Sessions
TWD
TWD's Avatar
King Spam Talker

Posts: 1,190
Trades: 0
Makes sense now. thanks.
__________________
RATE-MY-WEBSITE.com "Free website reviews by real web professionals"
Please login or register to view this content. Registration is FREE
TWD is offline
Reply With Quote
View Public Profile
 
Old 10-18-2010, 06:08 AM Re: Question about Sessions
Banned

Posts: 34
Name: Alan Smith
Location: USA
Trades: 0
Yes, if you want to destroy the session completely, then it is necessary to empty the session before using session_destroy();. Because, session_destroy() does not destroy global variables, so if you are using any global variables while your session is on, then it will not be removed using session_destroy();. So it is better to empty the session before destroying it.
alan123 is offline
Reply With Quote
View Public Profile Visit alan123's homepage!
 
Reply     « Reply to Question about Sessions
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.23133 seconds with 12 queries