...

View Full Version : Showing admin options for more than 1 user?



SMGames
07-24-2007, 08:44 AM
Hi, on my site i have more that one admin, i was wondering how i would start the $admin for more than 1 user.

This is how it works for just the 1 user:


<?php

if (@$_SESSION['loginname'] == 'SMgames')
{
$_SESSION['admin'] = 'true';}
else{$_SESSION['admin'] = 'false';}

if ($_SESSION['admin'] == 'true'){ ?>

ADMIN OPTIONS HERE

<?php ;} ?>


I was thinking would something like this work:


<?php

if (@$_SESSION['loginname'] == 'SMgames')
(@$_SESSION['loginname'] == 'Otheruser')
{
$_SESSION['admin'] = 'true';}
else{$_SESSION['admin'] = 'false';}

if ($_SESSION['admin'] == 'true'){ ?>

ADMIN OPTIONS HERE

<?php ;} ?>

If you have any ideas thanks.

_Aerospace_Eng_
07-24-2007, 10:57 AM
Your second example won't work because the line after the first part of the if statement isn't inside the parentheses. You would need to use the or operator.

SMGames
07-24-2007, 07:38 PM
How could you help me?

whizard
07-24-2007, 10:17 PM
You should give each user a permission level, and show the admin page if the user's permission is admin-level.

if($_SESSION['user']['permission'] == 2)
{
//Show admin page
}

HTH
Dan

SMGames
07-25-2007, 08:17 AM
What woul;d i have to do, would i have to set each user i want to be an admin to permission 2, if so how?

whizard
07-25-2007, 05:42 PM
Add a column to the user table in your database, and use it to hold the permission level for each user. Then, when the user logs in, retrieve that column's value along with the username, etc.

HTH
Dan



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum