Hi. This is an issue I know what I need to do, just cant think of a way to do it. If a user is not logged in and tries to access a members page, an error should be displayed to them.
My issue at the moment is this. I have a div which displays the result of a function. The function is
So, if the user is logged in, it will display showMembersPage within the div, if not, it will display the login form. The showMembersPage function isCode:function displayStatus(){ global $log_in; include "MPage.php"; if($log_in){ //if user logged in showMembersPage(); }else{ //else not logged in showLoginForm(); processLoginForm(); } }
If the user tries entering the direct url to the members page, nothing at all displays, which is understandable. However, I need to put somewhere within this members page that if the user is not logged in, display an error. I have tried the usual if statement, but this doesnt work. I have a feeling this is because this page is only called up if the member is logged in, and if they access it directly, it will never be invoked.Code:function showMembersPage(){ echo "Logged In"; }
This made me think I need to do it in the first page, but then the else statement is displaying and processing the form. Not sure where I can get the error displayed.
Any advise appreciated.






Bookmarks