Probleme with php session_destroy()
I never liked to use session but i had to in this case. the session contains an object used to store data will the user fill in a form the form is in 5 steps( 5 pages). to make sure that the session is clean if the user click on a link to another will filling in the form i use session_destroy but this seams to take forever i know the object gets a little big around 400Kb but server memory is 1.5Gb and i'm alone on it for now does anyone have a clue.
IF , ELSE , WHILE isn't that what life is all about
Suzanne posted this at 23:54 — 10th February 2004.
She has: 5,507 posts
Joined: Feb 2000
... can I see a snip of your code?
http://ca.php.net/function.session-destroy
<?php
session_unset();
session_destroy();
?>
This is what I use, but I don't know if that helps.
Mark Hensler posted this at 06:20 — 11th February 2004.
He has: 4,048 posts
Joined: Aug 2000
What kind of problems are you having? session_destroy() seems to be slow/hanging?
druagord posted this at 14:30 — 11th February 2004.
He has: 335 posts
Joined: May 2003
Yes thats what happens i will try Suzanne solution i didn't unset the sesson before destroying it.
this is the code that i put on every pages that are not in the form filling process
<?php
session_start();
session_destroy();
?>
IF , ELSE , WHILE isn't that what life is all about
druagord posted this at 15:29 — 11th February 2004.
He has: 335 posts
Joined: May 2003
ok i tried both of those and still the same thing
<?php
session_start();
session_unset();
session_destroy();
?>
<?php
session_start();
unset($_SESSION['myobject']);
session_destroy();
?>
IF , ELSE , WHILE isn't that what life is all about
Suzanne posted this at 17:04 — 11th February 2004.
She has: 5,507 posts
Joined: Feb 2000
You're not having these right in a row, are you?
<?php
1: session_start();
2: session_destroy();
?>
If you are, why? If you aren't, is there something happening between the start and stop that's a problem?
druagord posted this at 17:11 — 11th February 2004.
He has: 335 posts
Joined: May 2003
yes i am i do it to make sure that if the user go back to the form it will be empty (since the session contains the previously filled in values) so i do that on all pages that are not related to the form.
Humm now that i explain it i understand this is not optimal at all. since it will open and close the session even if the user never went to the form pages. :light: ok i will check for the referer before doing it.
IF , ELSE , WHILE isn't that what life is all about
druagord posted this at 17:30 — 11th February 2004.
He has: 335 posts
Joined: May 2003
Hey this gave me an idea i now clean up the session when back on the form instead this make code that look more logical, and working wich is certainly a good point thanks for your input.
IF , ELSE , WHILE isn't that what life is all about
Suzanne posted this at 17:42 — 11th February 2004.
She has: 5,507 posts
Joined: Feb 2000
if it's working, that's about all one can ask! Glad you were able to get it all straightened out.
druagord posted this at 18:25 — 11th February 2004.
He has: 335 posts
Joined: May 2003
Yeah i guess i have a tendancy to overcomplicate things
Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.