Jump to content

vetify login and then load second page?


philipjordan9999

Recommended Posts

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.

Link to comment
Share on other sites

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();
    }
Link to comment
Share on other sites

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.