philipjordan9999 Posted February 7, 2018 Share Posted February 7, 2018 Hi.I'm working on a small project to keep track of family elements. This will sit in a MySQL database. The MysQL stuff is fine, I can get by, but I'm looking for pointers as to the best way to go about this.So essentially, the visitor will hit the index.php page and that page will then check if the user is logged in. If yes - go to landing page, i.e. the 'main' page from which all queries will be run. If no - present the user with a blank page with nothing but a form for logging in. After that, go to the main page.I'm a little unsure how to go about this. Does the index.php check and then immediately bounce to login.php or landing.php (or similar)? Or does index.php contain the login form itself, and ... and what? All advice appreciated.Also, I've been using the O'Reilly book but it's not that good. Can someone recommend a really good PhP/MySQL tutorial which would guide me along the lines of what I want above? Thanks. Quote Link to comment Share on other sites More sharing options...
phpmillion Posted February 7, 2018 Share Posted February 7, 2018 (edited) I personally include file like "check_user_login.php" in all sections that need to be protected. The file that checks login looks the following: custom code to verify if user is logged in with valid password if ($user_is_logged_in!==true) { //redirect to login page header ("login.php"); exit(); } Edited February 7, 2018 by phpmillion 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.