soycharliente Posted June 10, 2007 Share Posted June 10, 2007 What's the best way to clear session variables upon leaving a page? Obviously I could set them to NULL or end the session on every other page, but that's a hassle. Link to comment https://forums.phpfreaks.com/topic/54917-solved-ending-sessions/ Share on other sites More sharing options...
AndyB Posted June 10, 2007 Share Posted June 10, 2007 Clear them, i.e. set to null or destroy them? http://ca.php.net/manual/en/function.session-destroy.php Link to comment https://forums.phpfreaks.com/topic/54917-solved-ending-sessions/#findComment-271629 Share on other sites More sharing options...
soycharliente Posted June 10, 2007 Author Share Posted June 10, 2007 I only want these session variables to work on 1 page. So they are cleared when I go to any other page on the site. If I destroy the session on that page, it won't work if they submit the form that returns to the same page. Link to comment https://forums.phpfreaks.com/topic/54917-solved-ending-sessions/#findComment-271636 Share on other sites More sharing options...
AndyB Posted June 10, 2007 Share Posted June 10, 2007 I only want these session variables to work on 1 page. So only check for their presence on that page ... or is there rather more to this problem? Link to comment https://forums.phpfreaks.com/topic/54917-solved-ending-sessions/#findComment-271638 Share on other sites More sharing options...
soycharliente Posted June 10, 2007 Author Share Posted June 10, 2007 But won't they exist on every page? What do you mean? I don't understand. Link to comment https://forums.phpfreaks.com/topic/54917-solved-ending-sessions/#findComment-271644 Share on other sites More sharing options...
Jago6060 Posted June 10, 2007 Share Posted June 10, 2007 you could try finding a javascript fucntion that says something like "on unLoad....session_destroy()". Or you could create a small php script that gets run when the form is submitted. So you'd have your "form_page"->"form_submission_page(mysql or whatever)"->"session_destroy_page"->"home_page" Link to comment https://forums.phpfreaks.com/topic/54917-solved-ending-sessions/#findComment-271657 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.