controlling/creating accounts with privileges


Posted on 16th Feb 2014 07:03 pm by admin

hi all,
i'm trying to figure out how i can create/control account with privileges, for instance an Administrator creates an account but gives it guest privileges (able to see data but not edit, or delete it, not able to create users).

when a user logs in, i store his/her privileges is a session.
Did you know?Explore Trending and Topic pages for more stories like this.
Code: $_SESSION['staff_privilege'] = $found_user['privilege'];
i wrote this function to check for privileges and placed it in the create user page. (1 = admin, 2 = guest)
Code: function get_privilege() {
if (logged_in() && isset($_SESSION['staff_privilege'])) {
if ($_SESSION['staff_privilege'] == 2) {
redirect_to("../staff/staff_browse.php?privilege=false");
}
} else {
redirect_to("../staff/index.php");
}
}

for instance if a user with guest privileges goes to create user page, he/she will get redirect to another page showing a message.

the above code is working, but i'm wanted other ideas about how this could be accomplished in another way
thanks
No comments posted yet

Your Answer:

Login to answer
142 Like 29 Dislike
Previous forums Next forums
Other forums

Career Change into SAP
Hai
I am sajesh ,did my diploma in Mechatronics i have a 4 years of experience in

How To Make More Than One Redirection with PHP on the same page?
Hey im trying to do a direction page where it open differently link direction pages every time som

CURL question
i am wondering if it's possible to use multi curl with login something like

login once to web

user administration
Dear @all,

what I have to do to set the user defaults for new users. At the moment I woul

SAP Business Suite
Hi all:

Within the SAP Business Suite solution I would like to ask you the main differenc

Redirecting Admin
In my members table, I have a field called "perm" and it's set to zero for all members. Ho

Greek characters in php
Hi,

I'm making a script and I m using for first time greek characters.
I started to write

ctype() validation - allowing illegal characters
Hello,
I use ctype() to filter and validate a user form. However, I am trying to allow certain c

PHP referral database. I would like this form to email the referrer.
Okay, Hello I've been trolling for years. This the first time I've ever asked for php help. Normally

fire away
i launched about 4 months ago as a lagit co. i have 2 paying clients, 1probono, 1 side progect, and

Sign up to write
Sign up now if you have flare of writing..
Login   |   Register
Follow Us
Indyaspeak @ Facebook Indyaspeak @ Twitter Indyaspeak @ Pinterest RSS



Play Free Quiz and Win Cash