twilightnights Posted January 30, 2007 Share Posted January 30, 2007 Hi I have a few questions on sessions in php.1 ) Do you have to place SessionStart(); at the top of EVERY page that makes use of the session?2 ) Do session variables carry over from 1 page to another automatically? IE I set up variables in 1 session on the login page then return to main, will it remember the same user name? Quote Link to comment https://forums.phpfreaks.com/topic/36394-solved-questions-on-sessions/ Share on other sites More sharing options...
Ninjakreborn Posted January 30, 2007 Share Posted January 30, 2007 [code]1 ) Do you have to place SessionStart(); at the top of EVERY page that makes use of the session?2 ) Do session variables carry over from 1 page to another automatically? IE I set up variables in 1 session on the login page then return to main, will it remember the same user name?[/code]1. Yes unless session autostart is turned on, in the ini file2. Yes.If the session start is at the top, as long as session destroy isn't called, and the browser isn't closed (iunless you modify there lifetime in the ini file. Quote Link to comment https://forums.phpfreaks.com/topic/36394-solved-questions-on-sessions/#findComment-173130 Share on other sites More sharing options...
twilightnights Posted January 30, 2007 Author Share Posted January 30, 2007 Cool, thanks. Was reading a tutorial on member systems. But I prefer not to copy and paste code and actually code, was making sure I understood it correctly. Quote Link to comment https://forums.phpfreaks.com/topic/36394-solved-questions-on-sessions/#findComment-173136 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.