Jump to content

Question about sessions and includes


Eiolon

Recommended Posts

I have a header file that will be included on each page.  Will I have problems if I put all the session information in the header file instead of each individual page?  I am trying to not have to query user permissions in each page.  I figured I would query for the user and its permissions in the header file and on the individual pages check to see if the user has permission to be on it.

 

Also, would that mean I still need to declare session_start(); at the top of each page or just the header include file?  Thanks.

Link to comment
https://forums.phpfreaks.com/topic/133568-question-about-sessions-and-includes/
Share on other sites

I figured I would query for the user and its permissions in the header file and on the individual pages check to see if the user has permission to be on it.

 

Why not store this information in your users session once when they login? Then retrieve it whenever you need from the $_SESSION array.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.