CodeIgniter Forums

Full Version: Controller Security
You're currently viewing a stripped down version of our content. View the full version with proper formatting.

El Forum

[eluser]rigniter[/eluser]
Hi -
Is there a way in CI to secure certain controllers or even function within controllers.
Let's take below code as example:

class User extends Controller {

//this is open to public
function index ()
{

}

//this requires login
function profile ()
{
>>Check whether user is logged in<<
}

//this is open to public
function highestrateduser()
{

}

}

Do I need to secure each controller in the above, or is there something that we can invoke in the config level to do this?
This can get very hairy as your code grows.

Thanks,

El Forum

[eluser]nmweb[/eluser]
Use a MY_Controller (see user guide) so all your controllers execute the is_logged_in() code.