php - Throwing Errors When User Try's To Modify -


I have installed a permission group system for a user group where a user can be, or the controllers can not access or modify them Could. / P>

Problem: If I modify all of my permissions to an arbitrary array for a particular user group and if that user group tries to modify the controller, Throwing is uncontrolled when modifying permissions.

How can I create it so that permissions can be uncontrolled, even if it does work. And if the user tries to modify that user group It will not throw these two errors.

Error one

  There was a serious error of PHP error: Notification Message: Undefined Index: Modified File Name: Library / User Php line number: 206  

error two

  There was a serious error of PHP error: warning message: in_array () Hopefully parameter 2 array, taped file name: libraries / User.php line number: 206  

User Library function

Public function is displaying () {$ user_id = $ this- & gt; CI- & gt; Session-> User data ('user_id'); $ Section = $ this- & gt; CI- & gt; Yuri- & gt; Segment_array (); $ Permission = release ($ Segment [2])? $ Segment [2]: ''; $ Ignore = array ('empty', 'error', 'register', 'dashboard', 'column_butt', 'menu', 'startup', 'login', 'logout', 'mistake', 'reset', ' Not_found ',' permission ',' footer ',' header '); If (isset ($ permission) & amp; amp; amp; amp; amp; amp; amp; amp; amp; user_id) {if (in_array ($ permission, ignoring $)) {true; } $ User_group_info = $ this- & gt; CI- & gt; User_model- & gt; GetUser ($ user_id); If (! $ User_group_info) is empty ($ user_group_data = $ this- & gt; CI- & gt; User_graph_model- & gt; GetUserGroup ($ user_group_info ['user_group_id']); // Error here (! In_array ($ permission, $ user_group_data ['permission'] ['modified'])) {return false; } And {return true; }} And {return false; }} And {back to true; }}

Not sure what exactly is $ this- & Gt; CI- & gt; Users_group_model- & gt; GetUserGroup () - However, before you in_array , if not exist, then check the index and forward the variable $ user_group_data to see it To see how it looks and getUserGroup through the function to see what it gives. See revision in the following functions:

  Public function is a publication change () {$ user_id = $ this-> CI- & gt; Session-> User data ('user_id'); $ Section = $ this- & gt; CI- & gt; Yuri- & gt; Segment_array (); $ Permission = release ($ Segment [2])? $ Segment [2]: ''; $ Ignore = array ('empty', 'error', 'register', 'dashboard', 'column_butt', 'menu', 'startup', 'login', 'logout', 'mistake', 'reset', ' Not_found ',' permission ',' footer ',' header '); If (isset ($ permission) & amp; amp; amp; amp; amp; amp; amp; amp; amp; user_id) {if (in_array ($ permission, ignoring $)) {true; } $ User_group_info = $ this- & gt; CI- & gt; User_model- & gt; GetUser ($ user_id); If (! $ User_group_info) is empty ($ user_group_data = $ this- & gt; CI- & gt; User_graph_model- & gt; GetUserGroup ($ user_group_info ['user_group_id']); // Error here // $ user_group_data does not have an index named Rev. // Check it here and see what is wrong with the getUserGroup function, user_group_data: & lt; Pre & gt; The value of "echo." Print_r ($ user_group_data, true) "& Lt; / pre & gt;"; // In any case if that index is not wrong then (('!!!', 'User_group_data')). (! Array_key_exists ('modify', $ user_group_data ['permission'])) {return false; } If (! In_array ($ permission, $ user_group_data ['permission'] ['modify'])) {returning;} other {return true;}} other {return false;}} else {return true;}}  

Comments

Popular posts from this blog

winforms - C# Form - Property Change -

java - Messages from .properties file do not display UTF-8 characters -

javascript - amcharts makechart not working -