OK, you're doing many things wrong, so I'm going to write in the answer box even though i might be overkill for your answer.
First, you're passing in user data into your query, which can be dangerous, because they can give you unsafe data that you need to make sure won't cause harm to your system by executing.
Second, you're not properly protecting your users passwords. PHP has a function for that called password_hash()
. It's REALLY easy to use, just password_hash($_POST['password'], PASSWORD_DEFAULT)` when you insert it into the database, rather than just the plain password as it looks like you're doing.
At the end of the day, I would suggest you use the PDO driver for PHP/MySQL. You can get an idea of how to set up your config.php file from here (scroll down to the PDO instructions 1/2 way down the page).
Once you've done that:
$stmt->prepare("SELECT * FROM sign_in WHERE user_name = :user_name")
$stmt->bindParam(':user_name', $_POST['user_name');
$stmt->execute();
$result = $stmt->fetch(PDO::FETCH_ASSOC);
You now have all the data from your sign in table. Side note, your sign_in table looks like it's probably just a users table, so maybe call it that for consistency with the rest of the world.
First, you want to compare the password they posted, with the hash in your database, and only proceed if it matches.
if(!password_verify($_POST['password'], $result['password']) {
// if the result is false, they need to be redirected.
header('Location: http://yoursite');
exit;
}
Now that we've verified they signed in, you can just show a specific header for each roll by looking at the "role_id" (which I"m assuming you have) from your results.
if($role_id == 1) { ?>
<b>You can just enter plain old HTML here - this is what you would put in for your admin header</b>
<?php } else { ?>
<b>This is the header that your user would see if they AREN'T an admin</b>
<?php } ?>
Sorry if this is overkill for your answer, but I tried to keep it as simple as possible as to how use prepared statements (to prevent SQL injection), the password_hash and password_verify functions, so you can store your users passwords securely (in hash form), and finally, showing a different header depending on user roll.
Unfortunately, it probably isn't copy/pastable into your current code, but I would suggest reading the link I provided (PDO), and then proceed from there. Shouldn't take you long at all, I promise!