I already have a login system ready and 100% working, but now I would like to add access levels when logging in and I have no idea how. In my database, in the table of my logins, there is a column that I created called 'permission_level' and the default is set to 'default', and the administrators as 'master'
How can I solve this?
Unsuccessful attempt:
<?php
$mysqli = new mysqli('', '', '', '');
if (mysqli_connect_errno()) {
printf("Connect failed: %s\n", mysqli_connect_error());
exit();
}
$query = "SELECT permission_level FROM authme WHERE = '".$user."'";
echo $user;
if ($result = $mysqli->query($query)) {
/* fetch associative array */
while ($row = $result->fetch_assoc()) {
printf ("%s \n", $row["permission_level"]);
}
/* free result set */
$result->close();
}
session_start();
$_SESSION['UserSession'] = $_POST['username'];