desjardins2010 Posted December 15, 2010 Share Posted December 15, 2010 hey all; I have a member.php page filled with html and some php, at the top the first thing it does is check for a session if it's not present it displays Sorry you must be logged in to view this page if it's there is says welcome blah blah blah problem is even if it's not present it's showing all the rest the content under the sorry you must be logged in to view this page.. tried adding an exit; did the same thing showed content and tried die; did the same thing showed content? Quote Link to comment Share on other sites More sharing options...
kenrbnsn Posted December 15, 2010 Share Posted December 15, 2010 Code? Quote Link to comment Share on other sites More sharing options...
desjardins2010 Posted December 15, 2010 Author Share Posted December 15, 2010 <?php session_start(); if (!isset($_SESSION['username'])) { echo "Sorry you must be logged in to view this page<BR>"; echo "Please <a href='index.php'>GO BACK</a> and try again"; } else { if ($_SESSION['username']) { echo "Welcome, ".$_SESSION['username']."!<BR>"; echo "<a href=\"logout.php\">LOGOUT</a>"; } } ?> THEN...HTML if there is no session I want this not to show if there is and all is well show everything to the validated user Quote Link to comment Share on other sites More sharing options...
desjardins2010 Posted December 15, 2010 Author Share Posted December 15, 2010 anybody? Quote Link to comment Share on other sites More sharing options...
MMDE Posted December 15, 2010 Share Posted December 15, 2010 elseif(isset($_SESSION['username'])){ } Quote Link to comment Share on other sites More sharing options...
mikecampbell Posted December 15, 2010 Share Posted December 15, 2010 Where did you put your exit() statement? It should be in the first "if" block. Quote Link to comment Share on other sites More sharing options...
desjardins2010 Posted December 16, 2010 Author Share Posted December 16, 2010 Thanks I was using the wrong format exit; should been exit(); 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.