I have a policy of not just writing people's code for them, feeling they'd learn more if they make their own attempts. Give a man a fish and he'll eat for a day. Give a man a stick of dynamite and he'll be eating fish all week.
session_start();
if($_SESSION['logged']!=true)
{
header('Location: login.php');
exit();
}
if($_SESSION['username'] not in db with adequate permissions)
{
header('Location: login.php');
exit();
}
//logged.