I have a login page that works 100% but it's only storing the username and not my other value which is user_level
<?php
session_start();
include('connection.php');
$login = mysql_query("SELECT * FROM $table2 WHERE (username = '" . mysql_real_escape_string($_POST['username']) . "') and (password = '" . mysql_real_escape_string(md5($_POST['password'])) . "')");
if (mysql_num_rows($login) == 1) {
$_SESSION['username'] = $_POST['username'];
$_SESSION['user_level'] = $_POST['user_level'];
header('Location: .././site/index.php');
}
else {
header('Location: .././index.php');
}
?>
Not sure if I have to but something in where the $login connection to the database is? or should my $_SESSION['user_level'] enough?
my other page where I'm testing to make sure that the user_level is stored correctly isn't showing up, but the username is showing.
Your Username <?php echo $_SESSION['username']; ?><br>
Userlevel <?php echo $_SESSION['user_level']; ?><br>
<a href='.././user/logout.php'>Logout</a><br>
First time I have worked with sessions