Welcome Guest, Not a member yet? Register   Sign In
Best Practice Question
#7

[eluser]@li[/eluser]
Here's the restrict function mentioned above in case it helps:

Code:
function restrict($minLevel)
    {
        if (! is_numeric($minLevel))
            return false;
            
            
        $url=$this->obj->uri->uri_string();
        if (! $this->isLoggedIn())
        {
            //Set url of the current page in the session, so upon logging in they're
            //redirected back to this page        
            $this->obj->session->set_userdata('redirect_url',$url);
            header('location: '.$this->loginPageUrl);
            die;
        }
        
        if ($this->obj->session->userdata($this->lvlField) < $minLevel)
        {
            header('location: '.$this->membersAreaUrl);
            die;
        }
        return true;
    }

Its a bit outdated obviously, I wrote it before I started using CI hence its still using header('location') to redirect Smile. But,it does the job for now.


Messages In This Thread
Best Practice Question - by El Forum - 12-06-2008, 03:00 PM
Best Practice Question - by El Forum - 12-06-2008, 04:28 PM
Best Practice Question - by El Forum - 12-06-2008, 04:41 PM
Best Practice Question - by El Forum - 12-06-2008, 04:46 PM
Best Practice Question - by El Forum - 12-06-2008, 04:51 PM
Best Practice Question - by El Forum - 12-07-2008, 07:12 AM
Best Practice Question - by El Forum - 12-07-2008, 07:15 AM
Best Practice Question - by El Forum - 12-08-2008, 04:34 AM



Theme © iAndrew 2016 - Forum software by © MyBB