Jump to content

Help with User Login on index.php includes


craigj1303

Recommended Posts

Hi All

 

I developed a site using PHP & a MYSQL database. From the off I structured the site by routing everything through index.php. This way the page shell (banner, navigation etc) is always consistent and I use includes for the various page contents.

 

This has been fine up until now. But now I am designing in a new aspect to the site which requires a user to login to view some content. Now, the problem is that I want to check if the user has logged in before certain content is displayed, and I have a confirm_login() function that checks if a $_session variable has been set for login. If the login $_Session variable hasn't been set the user is diverted to the login page. But this confirm_login() function requires me to check for a user login on every page and I only need the user to be logged in for a few secure pages. But as everything is routed through index.php how can I best handle this?

 

Regards

 

Craig

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.