hackerkts Posted June 26, 2007 Share Posted June 26, 2007 I have written a login page, login.php, And I have a protected page(only logged in users are allow to view) which will require login.php on the very first line. Which one of these methods is the best? On the login.php put exit(), so if not authorized user access protected page it will only show the login form and cut of the rest of the page, it also cuts of body and html's tag. Make use of if else statement on protected page Anyone answer(s) is appreciated, thanks! Quote Link to comment Share on other sites More sharing options...
trq Posted June 26, 2007 Share Posted June 26, 2007 Completely up to you. I normally check if the user has a valid session, if not, redirect to the login page. Quote Link to comment Share on other sites More sharing options...
hackerkts Posted June 26, 2007 Author Share Posted June 26, 2007 Hey thorpe, thanks for the fast reply! Oh yes, I will try your way, thanks again. Quote Link to comment Share on other sites More sharing options...
cluce Posted June 26, 2007 Share Posted June 26, 2007 I have a query and an if statement that checks for a valid user logged in and matches it with the data in the database at the top of all my protected pages. I use the SESSION in my where clause to identify the user that was logged in at login page. 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.