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? Link to comment https://forums.phpfreaks.com/topic/221785-exit-script-from-showing/ Share on other sites More sharing options...
kenrbnsn Posted December 15, 2010 Share Posted December 15, 2010 Code? Link to comment https://forums.phpfreaks.com/topic/221785-exit-script-from-showing/#findComment-1147789 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 Link to comment https://forums.phpfreaks.com/topic/221785-exit-script-from-showing/#findComment-1147796 Share on other sites More sharing options...
desjardins2010 Posted December 15, 2010 Author Share Posted December 15, 2010 anybody? Link to comment https://forums.phpfreaks.com/topic/221785-exit-script-from-showing/#findComment-1147823 Share on other sites More sharing options...
MMDE Posted December 15, 2010 Share Posted December 15, 2010 elseif(isset($_SESSION['username'])){ } Link to comment https://forums.phpfreaks.com/topic/221785-exit-script-from-showing/#findComment-1147832 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. Link to comment https://forums.phpfreaks.com/topic/221785-exit-script-from-showing/#findComment-1147834 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(); Link to comment https://forums.phpfreaks.com/topic/221785-exit-script-from-showing/#findComment-1147902 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.