I am writing a web application using codeigniter.
I want to authenticate the privilege of our users before they access the page.
Actually nearly all controller action except the log in page need to call the model and use
$this->Users->validate($username, $password)
I want to make it general for every controller. Do I need to inherit the controller class? How could i do that?
We have a project using Codeigniter and the way we are doing it :
When you have a new controller :
class xxxx extends MY_Controller { }
And Inside the MY_Controller class
function __construct() {
// do your validations
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With