Small series today write down on the background administrator permissions to assign their own ideas and ideas
Copy CodeThe code is as follows:
/**reader
* Small series of ideas relatively simple implementation of the function
* First the ID number of each column is fixed and then the total administrator
* When you create an administrator and assign permissions to the administrator, tick the appropriate columns
* This will insert the ID number of the column into the database, when the administrator login
* Get the column ID number that this administrator should have. The navigation on the left is based on the current column ID not in the administrator's
* Column ID number to judge the display or not display it.
*/
Header ("Content-type:text/html;charset=utf-8");
Error_reporting (E_error);
$act = $_get[' act '];
$conn = mysql_connect (' localhost ', ' root ', ' root ');
mysql_select_db (' study ', $conn);
mysql_query (' Set names UTF8 ');
if ($act = = "Add") {//Here is the method added
$prom = $_post[' prom '];
/*
Insert the array into a string after getting the column ID into the database
Because the database does not provide a field type to insert an array
*/
$par = Implode (', ', $prom);
Here is an example of the admin user.
$sql = "INSERT into Rc_admin (admin_name,pres) VALUES (' admin ', ' $par ')";
mysql_query ($sql);
if (mysql_insert_id () >0) {
echo "Success";
}else{
echo "Error";
}
}
?>
This is the permissions assigned to the page to check that he already has this permission (Administrator permissions should be assigned by admin)
The navigation section on the left is based on when an administrator logs in to get this cookie for this administrator
Copy the Code code as follows:
This should be the value of the cookie obtained after login
$sql = "SELECT * from rc_admin where Adminid = 1";
$res = mysql_query ($sql);
$list = Mysql_fetch_assoc ($res);
/*
Or get this data and use explode to divide him into groups.
Then the column ID value is not in the array, then the column is displayed.
*/
$pros = $list [' pres '];
$pros = Explode (', ', $pros);
Use the In_array () function to determine if the column ID is not displayed in the $pros.
Reward Recruitment |
| Add a reward Enterprise |
}?>
| Manage Reward Enterprises |
}?>
| Manage Reward positions |
}?>
This is the left column navigation.
This is based on the administrator login he should have the right to display the corresponding columns.
http://www.bkjia.com/PHPjc/326924.html www.bkjia.com true http://www.bkjia.com/PHPjc/326924.html techarticle Small series today to write about the background administrator permissions to assign their own ideas and ideas copy code code as follows: PHP/**reader * Small series of ideas relatively simple implementation of the function * first each column ...