While I'm here I'll explain why I used
die('Sorry, but you dont have permission to view this page!');
As opposed to
echo "Sorry, but you dont have permission to view this page!";
Using "echo"
If the person types in the wrong username and/or password it'll display the "Sorry, but you dont have permission to view this page!" message but will also display the contents below it.
Using "die"
If the person types in the wrong username and/or password it'll display any information down to where you have your if statement.
Lets say you had
<?php
session_start();
$_SESSION['username']
//check to see if user has loged on with valid password
if (!$_SESSION['authuser']=1) {
die('Sorry, but you dont have permission to view this page!');
}
//the other php here
?>
While $_SESSION['username'] will be displayed the php under the "die" statement will not be displayed.