CodeIgniter Forums
Is this correct way... - Printable Version

+- CodeIgniter Forums (
+-- Forum: Archived Discussions (
+--- Forum: Archived General Discussion (
+--- Thread: Is this correct way... (/thread-1799.html)

Is this correct way... - El Forum - 06-27-2007

I found solution. how to include in every page login form, but do not really know if it is correct. the method I used is I auto loaded library. and the library constructor is doing the following:
class Authorize {
    function Authorize(){
        $this->CI =& get_instance();
        $this->CI->mysmarty->assign('login_errors', null);
        $this->CI->mysmarty->assign('user', $this->CI->session->userdata('user_data'));
        $this->CI->mysmarty->assign('logged_in', $this->CI->session->userdata('logged_in'));
        if (isset( $_POST['submit']) && $_POST['submit'] == 'Login'){

So when login form is submitted authorize library calls function which then processes login.

What it is interesting for me am I doing the right way. It seems OK for me, but I believe there are/can be some issues why this cannot be done.

Also would be nice to hear suggestions and critics.