craigj1303 Posted August 27, 2013 Share Posted August 27, 2013 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 https://forums.phpfreaks.com/topic/281584-help-with-user-login-on-indexphp-includes/ Share on other sites More sharing options...
molossus Posted August 27, 2013 Share Posted August 27, 2013 What if you create a subdirectory and place that index file and the login php script there so that it is separate from the other index.php file Link to comment https://forums.phpfreaks.com/topic/281584-help-with-user-login-on-indexphp-includes/#findComment-1446919 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.