How can I switch the output of an entire PHP page?

  • Thread starter Thread starter Puffyfluff
  • Start date Start date
P

Puffyfluff

Guest
I am making a few PHP pages that can only be viewed when you're registered. Is there a way to do this without redirecting?
Like:

<?php
start session();
if ($_SESSION['loggedin']==TRUE) {echo '<html><!--page contents--></html>';}
else {echo 'You are not logged in. Please <a href="login.php">log in</a> to continue";
?>

How can I make it do this without printing the whole entire page? Sorry, I'm new to PHP.
 
Back
Top