开发者

DX Auth Configuring

I just got down uploading and configuring what I thought was correctly for the DX Auth plugin for Code Igniter but now I'm getting a "500 Internal Server Error". From that link I'm wanting it to go to the login page but maybe I didn't do something right. http://kansasoutlawwrestling.com/kowmanager

Edit:

Okay 开发者_运维知识库so what I did was deleted everything from my server and uploaded the application and system folders to my public_html (www) root directory. I created a controller for my CMS that is called kowmanager. What is going to happen when the controller is loaded it will check to see if a session exists and if not then it will load the login model and view and I'm wanting dx auth to handle that but I'm still not sure how to implement it in.

Edit 2: Any ideas?


What is going to happen when the controller is loaded it will check to see if a session exists and if not then it will load the login model and view and I'm wanting dx auth to handle that but I'm still not sure how to implement it in.

If you're using the Session class, the session itself will always exist - what you really want is to check if the user is authorized or not, so just go ahead and load your auth library right away in the controller.

Here's what it might look like:

class Kowmanager extends CI_Controller {

    public function __construct()
    {
        $this->load->library('dx_auth');

        // Make sure we don't check permission while on the login page
        $is_login_page = $this->router->method === 'login';

        if ( ! $is_login_page && ! $this->dx_auth->is_logged_in())  
        {  
            redirect('kowmanager/login');
        }
    }

    function login()
    {
        // Make sure the user isn't already logged in
        // Load your login form
        // Process the login
        // Redirect somewhere else once logged in
    }

}

It seems that DX Auth is well documented, although perhaps a bit outdated, so just follow some of the examples they have provided in the documentation.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜