JamesCliff
Programmer
Hi all,
Ok.... i have a page with the following code (note: these are snippets of code from the page)
As you can see this is where i get my $logged_in and $user_lev variable from. $user_lev is the important variable here as everything else works how its supposed to.
Further down the page i have this snipped of code:
Now as you can see above if the $logged_in variable is set to 1 then the logged in text is displayed. This works fine, however im setting up a user level system.
Basiclly as you can see in the first snippet of code im getting the specific users user_level from the database. There is 2 values the users level can be; these are 0 (member with no privalages) and 1 (site mod / admin).
I want it so when a user with a 0 $user_lev value signs in they are greeted with the original logged in message thats within the second snippet of code. However when a user with a $user_lev of 1 signs in they are greeted with the same message as the normal members message except it has the word "ADMIN" at the end. Once i have achieved this i can customize it even more.
Ive tried using IF statements within the $logged_in ifstatment but they dont work as they should. Is there anyway i can achieve what im trying to do? Surely it dosnt require much more code, a couple of lines maybe, however im not experienced enough to do this correctly.
Any help greatly appriciated.
Thanks alot
Jim
Ok.... i have a page with the following code (note: these are snippets of code from the page)
Code:
if($_SESSION['password'] == $db_pass['password']) {
$logged_in = 1;
$user_lev = $db_object->query("SELECT user_level FROM brisk_users WHERE username = '".$_SESSION['username']."'");
} else {
$logged_in = 0;
unset($_SESSION['username']);
unset($_SESSION['password']);
}
As you can see this is where i get my $logged_in and $user_lev variable from. $user_lev is the important variable here as everything else works how its supposed to.
Further down the page i have this snipped of code:
Code:
if($logged_in == 1) {
?>
<div align="left"><font size="1" face="Verdana, Arial, Helvetica, sans-serif" color="4C4C4C">Welcome back <?php echo $_SESSION['username']; ?>,
you are logged in. </font></font><font color="4C4C4C" size="1" face="Verdana, Arial, Helvetica, sans-serif"><a href="logout.php">**LOGOUT**</a></font></div>
<?php
}
else
{
...................
}
Now as you can see above if the $logged_in variable is set to 1 then the logged in text is displayed. This works fine, however im setting up a user level system.
Basiclly as you can see in the first snippet of code im getting the specific users user_level from the database. There is 2 values the users level can be; these are 0 (member with no privalages) and 1 (site mod / admin).
I want it so when a user with a 0 $user_lev value signs in they are greeted with the original logged in message thats within the second snippet of code. However when a user with a $user_lev of 1 signs in they are greeted with the same message as the normal members message except it has the word "ADMIN" at the end. Once i have achieved this i can customize it even more.
Ive tried using IF statements within the $logged_in ifstatment but they dont work as they should. Is there anyway i can achieve what im trying to do? Surely it dosnt require much more code, a couple of lines maybe, however im not experienced enough to do this correctly.
Any help greatly appriciated.
Thanks alot
Jim