Wednesday 21 September 2011

PHP session_start() question?

I have my site structure set up so that my 1 main-index page grabs the page content from the other .php pages.

This is causing much headache when trying to include files with session_start() for login. Is it bad to have session_start(); initiated at basically every page change on the site? Doing it this way works perfectly x_xPHP session_start() question?You have to call session_start() on every page that you need to access session data. This includes any %26quot;secure%26quot; page you have on your site because you script probably checks to see if the user is logged in first.



To be more specific, no, it's not bad to call session_start on every page. Just put it right at the top of your main-index page.
PHP session_start() question?
usually i would create a config.php file like this:



%26lt;?php



session_start();



/*



DATABASE INFO HERE OR OTHER STUFF



*/



?%26gt;



and just include it at the top of everypage..