well this code works:
<?php
session_start();
echo '<h1>Members only</h1>';
// check session variable
if (isset($SESSION['valid_user']))
{
echo '<p>You are logged in as '.$SESSION['valid_user'].'</p>';
?>
<h1>hello all</h1>
<?php
}
else
{
echo '<p>You are not logged in.</p>';
echo '<p>Only logged in members may see this page.</p>';
}
echo '<a href="authmain.php">Back to main page</a>';
?>
BUT, if I try to split this into:
<?php include("header.php") ?>
<h1>hello all</h1>
<?php include("footer.php") ?>
so I dont have to copy and paste the beginning php and ending php portions onto every page I get:
Parse error: syntax error, unexpected $end in C:\klatt\webdocs\header.php on line 12
This is driving me crazy lol.
EDIT: I just found this website:
http://www.theukwebdesigncompany.com/php/manual/modules.php?name=PHP_Manual&page=migration4.parser.html
So, it looks like this is probably not possible anymore (using php5). Any ways to get around this?