Here is a block of code which shows 3 different user levels and how to output code blocks based on that output level.
<?php session_start();
//echo $_SESSION[‘session_name’];
//set a variable to the session name
$user = $_SESSION[‘session_name’];
if ($user) {
//select statement to find access level based on unique username
$command=”SELECT table.ID, table.Username, table.access_level from table WHERE table.Username=’$user’;”;
$result = mysqli_query($db, $command);
if ($result && mysqli_num_rows($result) > 0){
while($row = mysqli_fetch_assoc($result)) {
//echo $row[‘Username’];
//echo $row[‘access_level’];
if ($row[‘access_level’]==’1′) {
//add custom content here for this user access level?>
<?php }
else if ($row[‘access_level’]==0){
//add custom content here for this user access level
?>
<?php
}
}
}
} else {
//add custom content here for public access level
?>
<?php }?>
© 2018 ALL Rights Reserved | Sitemap
Vancouver | North Vancouver | Burnaby | Richmond | Coquitlam | Port Coquitlam | Surrey | Langley | Maple Ridge | Mission | Abbotsford | Kamloops | Kelowna | Victoria | Squamish | Whistler | Pemberton