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
29
Other forums
Quick variable question
hey guys/gals,
im trying to write a php script and it works fine as i have it, but i need to set
checkbox update
I am having a brain fart right now and i cant remember how to do this. if anyone could help that wou
need help in update query
hi
i have a dynamic form. i need help in how can i use update query when values from dynamic for
for some reason mysql query not working, not inserting, please check it out
This code is not inserting anything into my db, don't know why, the $_SESSION variable does contain
PHP time (deadline within one week)
I have a column ['projdue'], which stores the deadline for a project.
I have PHP code and <
JSON SORT WITH PHP
I have two products that I want to sort by say "Id:17, value: xxx" using php
The page w
tag inside php... hi
Code: <?php echo "<td width="$columnWidth%" align=&Find current logon time Hi,
in my sql script i want to query and find out the logon time of the current session.
< cstdatomic (c++0x std::atomic) / g++ 4.4 Hello,
I'm trying to use cstdatomic (std::atomic in the upcoming c++0x standard) in g++ IF STATEMENT HELP Hi i have created a calendar from a table:
Code: Calendar: October 2009 <table w
|