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

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.