int21h Posted June 25, 2007 Share Posted June 25, 2007 is it ok if the session_start() is run for multiple times. if run in multiple times what will happen? Quote Link to comment Share on other sites More sharing options...
redarrow Posted June 25, 2007 Share Posted June 25, 2007 session start needs to be on all pages that use the session's. that it but it must be at the top off all pages ok. <?php session_start(); ?> Quote Link to comment Share on other sites More sharing options...
Wuhtzu Posted June 25, 2007 Share Posted June 25, 2007 What would you like to happen? My guess is nothing will happen except from the a session getting started. Why have the multiple session_start() ? <?php session_start(); session_start(); ?> Quote Link to comment Share on other sites More sharing options...
int21h Posted June 25, 2007 Author Share Posted June 25, 2007 for example my index.php has one session_start() and if the page is reloaded what will happen? is the session_start will run again or the php will ignore the code? Quote Link to comment Share on other sites More sharing options...
int21h Posted June 25, 2007 Author Share Posted June 25, 2007 you mean to say as in all of the pages or just the page needed to run the session. i thought the session will not expired unless specified. why is it that the all pages must have session_start? session start needs to be on all pages that use the session's. that it but it must be at the top off all pages ok. <?php session_start(); ?> Quote Link to comment Share on other sites More sharing options...
soycharliente Posted June 25, 2007 Share Posted June 25, 2007 As of now, calling session_start() while the session has already been started will result in an error of level E_NOTICE. Also, the second session start will simply be ignored. Quote Link to comment Share on other sites More sharing options...
redarrow Posted June 25, 2007 Share Posted June 25, 2007 The reason we put session start on all pages is to let the php.ini no that the session is going also be used on that new page so in essance the session gets life exstention. if the session start wasent there then there could be a chance that the session will go dead and therefore all that information the user just typed in has all gone to wast. yes it true a session will be set for a few seconds before going dead but we need it alive while the user uses all our pages. a session relies on cookies but has it own built in function for the server to get the cookie infomation and place it in a file on your server. if a user has cookies off then php will use it own function and cheek the session file to see if there a set cookie for that browser if use it. if you turn your cookies off your see the sid (session number) in the browser that was created to the server session php file. Quote Link to comment Share on other sites More sharing options...
int21h Posted June 28, 2007 Author Share Posted June 28, 2007 thanks for the information guys! Quote Link to comment 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.