I want to make some actions available only for logged in users.
I’ve tried to restrict some by this code:
function _remap($method)
{
$restricted = array('update_rating', 'delete_post');
if( ! $this->session->userdata('logged_in') && in_array($method, $restricted))
{
echo 'Log in, please';
}
else {
$this->$method();
}
}
But $this->$method() didn’t receive parameters which was sent in url. What to do?
I want to make some actions avalible only for logged in users.
To restrict logged in users for an entire controller use something like:
Or do the same if you need to restrict a specific method:
This requires that you have an is_logged_in variable set before the controller is called.
I use a a MY_controller that checks for a logged in session that all controllers inherit.