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! Link to comment https://forums.phpfreaks.com/topic/57284-solved-quick-question-about-log-in-form/ 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. Link to comment https://forums.phpfreaks.com/topic/57284-solved-quick-question-about-log-in-form/#findComment-283145 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. Link to comment https://forums.phpfreaks.com/topic/57284-solved-quick-question-about-log-in-form/#findComment-283146 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. Link to comment https://forums.phpfreaks.com/topic/57284-solved-quick-question-about-log-in-form/#findComment-283203 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.