TGWSE_GY Posted April 23, 2009 Share Posted April 23, 2009 I am wondering, does $_SESSION need to be started at the beginning of every page or only pages that are going to need to use $_SESSION Variables. Thanks Link to comment https://forums.phpfreaks.com/topic/155392-solved-php-_session/ Share on other sites More sharing options...
revraz Posted April 23, 2009 Share Posted April 23, 2009 Only on pages that use Sessions. Link to comment https://forums.phpfreaks.com/topic/155392-solved-php-_session/#findComment-817616 Share on other sites More sharing options...
radi8 Posted April 23, 2009 Share Posted April 23, 2009 According to the documentation, it is only necessary on the pages where it is required, but imho, if you are using session variables, then it should be used on every page. Also, look at session.auto_start Link to comment https://forums.phpfreaks.com/topic/155392-solved-php-_session/#findComment-817621 Share on other sites More sharing options...
TGWSE_GY Posted April 23, 2009 Author Share Posted April 23, 2009 So do I just put session_start(); at the top of all the pages that are say in my members area and I will have access to that users assoc array of $_SESSION variables? Link to comment https://forums.phpfreaks.com/topic/155392-solved-php-_session/#findComment-817638 Share on other sites More sharing options...
mattal999 Posted April 23, 2009 Share Posted April 23, 2009 Yes. That is exactly what you should do. Link to comment https://forums.phpfreaks.com/topic/155392-solved-php-_session/#findComment-817644 Share on other sites More sharing options...
tang Posted April 23, 2009 Share Posted April 23, 2009 Consider using an include page if you aren't already. That way you can start your session, check that the member is logged in etc all in 1 file without having to re-type the same code in each file. Link to comment https://forums.phpfreaks.com/topic/155392-solved-php-_session/#findComment-817658 Share on other sites More sharing options...
TGWSE_GY Posted April 23, 2009 Author Share Posted April 23, 2009 thanks guys got it working it went off without a hitch!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! Link to comment https://forums.phpfreaks.com/topic/155392-solved-php-_session/#findComment-817935 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.