I need to ensure that certain pages in my site can't be seen unless a user is logged in. I had written a script to do this and it's not working. Here's the script:
<?php
if(!$_SESSION['username']
{
header(Location:'attendancelogin.php');
exit;
}
?>
When I log in on the site and click a link to a page that uses the template I created for pages that require a user to be logged in (which has the code above inserted into the <head> tag) I get this error:
Parse error: syntax error, unexpected ';' in C:\xampp\htdocs\osumusic\checkstudentattendance.php on line 7
Also, I just found out that I'm going to have to further protect certain pages on the site so that only admins can see these pages and not just regular members.
So...can anyone help me edit my code to ensure that users have to be logged in to see the page and also how do I need to change the code to only allow admins onto certain pages?
(I have it set up so there are 2 seperate tables in my database to handle each set of users, if that helps to clarify).