Jump to content

exit script from showing


desjardins2010

Recommended Posts

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

<?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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.