as for your syntax error:
you need a semi-colon at the end of the this statement
$user = $_SESSION['user']
You are unable to do a header location once you have an output.
for example in your code:
if($admin == 2)
{
echo 'Welcome back <strong> . $_SESSION['user'] . </strong>! Your access to the Admin Panel has been limited for security reasons.';
header('Location: dashboard');
}
you will receive an error, and it won't use your header redirect because you have already printed something to the page.
It should look something like:
if($admin == 2) {
header('Location: dashboard');
exit;
}
Then on your "dashboard" page say "Welcome back ....";
A couple of other things to notice:
echo 'Welcome back <strong> . $_SESSION['user'] . </strong>! Your access to the Admin Panel has been limited for security reasons.';
// should be
echo 'Welcome back <strong> '. $_SESSION['user'] .' </strong>! Your access to the Admin Panel has been limited for security reasons.';
// for correct concatenation
Additionally:
header('Location: dashboard');
Assuming that you are at a URL of something like "mywebsite.com/admin/" this header redirect will send you to "mywebsite.com/admin/dashboard".
The row in the user table must be set to 1 for you to be admin if not your not admin
You are allowing $admin==2 to go to the "dashboard" as well.