Welcome Guest, Not a member yet? Register   Sign In
Restrict some actions, _remap function
#1

[eluser]SpaceCoder[/eluser]
I've tried to restrict some function by this construction:
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?
#2

[eluser]Twisted1919[/eluser]
When using _remap, if you have a method like :
Code:
public function something($uri1='',$uri2='')
{
    // code here .
}

You won't be able to use $uri1 and $uri2,
instead, use directly $this->uri->segment(1) and $this->uri->segment(2);




Theme © iAndrew 2016 - Forum software by © MyBB