I am using the CodeIgniter framework for PHP . There are several pages that are intended exclusively for the administrator, and they are located in Admin/* . When a user logs in, I save some value in the session as a flag and check it in my controller to check if the user is registered or not. I wrote code to verify the session in each method of my controller. But then I realized that I did not want to write the same line of code in each method, since many problems are created from the point of view of ease of maintenance. Then I decided to create an exclusive controller that will load only the views of the administrator and, therefore, in it the constructor, I will check the value of the session. Is there any other method besides this approach. Am I doing it right? Or is any other secure mechanism available in CodeIgniter ?
source share