Page 1 of 1

a question about sessions and custom sessions

Posted: Thu Mar 20, 2003 10:16 am
by kendall
Hello,

I am asking this question mainly because i am begining to recieve alot of vastly different suggestions in response to it

i am using the server generated session or session is using session_start(PHPSESSID) to track a visitor untill he has finished filling out a form. the reason i did this is because it was the most simplist way i find to identify a person temporaraly

the problem i seem to be facing is that i am unable to unregister or destroy the session. using session_unset() and session_destroy() as after filling out the form and then trying to do it again i notice that the phpsessid is the same even when i flush the browser cache.

why is it not freeing/ destroying the session?

now i was attempting to use a session_id and session_name but kept running into a heaer alreay sent error scenario

was this my best approach? as it seems to work very well with me as the session id was being auto generated for me by php / sever and using it was as easy as echo $PHPSESSID

is there any downfall to this method other than the extra long id # which i dont mind?

Kendall

Posted: Thu Mar 20, 2003 1:01 pm
by daven
If you are using superglobals ($_SESSION), session_unset does not work. The way to destroy a session is like so:

session_start();
$_SESSION=array();
session_destroy();
unset($_COOKIE[session_name()]);

a question about sessions and custom sessions

Posted: Fri Mar 21, 2003 7:28 am
by kendall
Hey,

Well this is exactly my point

im not using $_SESSION

thus

sessiont_start()
session_unset() or session_unset($PHPSESID)
session_destroy();

should work!

then why isnt it?

Kendall

a question about sessions and custom sessions

Posted: Sat Mar 22, 2003 2:00 pm
by kendall
I really am trying to figure out how this session thing works

See im using the $PHPSSESID default session variable to track a visitor tru to the end of a process.

Im trying to session_unset();

and session_destroy() it and it is not being destoryed.

session_unset() suppose to free all session variables right? isnt $PHPSESSID a variable?

how do i then destroy the $PHPSESSID ? so that when the person comes back he gets a new $PHPSESSID?

Kendall