Welcome Guest, Not a member yet? Register   Sign In
Problem in login system while using Ajax
#4

[eluser]kmil0[/eluser]
crete a file MY_Controller.php
in /system/application/libraries/

then write something like this

Code:
class MY_Controller
{
function __construct()
{
   parent::__construct();
   if( ! $this->session->userdata('logged_in') )
   {
    // redirect to the login page.
    redirect('auth');
   }
}
}

with this you will not worry about check the controllers
that require authentication.

Smile

sorry for my bad english Tongue


now every controller that requires authentication may look like this

Code:
class News extends MY_Controller
{
    // your normal code here
}

and the auth controller look like this

Code:
class Auth extends Controller
{
function __construct(){ parent::__construct();}
function index(){ $this->load->view('login_view')}
}


Messages In This Thread
Problem in login system while using Ajax - by El Forum - 10-02-2009, 10:14 AM
Problem in login system while using Ajax - by El Forum - 10-02-2009, 04:20 PM
Problem in login system while using Ajax - by El Forum - 10-02-2009, 06:00 PM
Problem in login system while using Ajax - by El Forum - 10-02-2009, 06:47 PM
Problem in login system while using Ajax - by El Forum - 10-02-2009, 07:10 PM
Problem in login system while using Ajax - by El Forum - 10-02-2009, 07:30 PM
Problem in login system while using Ajax - by El Forum - 10-03-2009, 01:25 AM
Problem in login system while using Ajax - by El Forum - 10-03-2009, 04:14 AM
Problem in login system while using Ajax - by El Forum - 10-03-2009, 04:58 AM
Problem in login system while using Ajax - by El Forum - 10-03-2009, 05:39 AM
Problem in login system while using Ajax - by El Forum - 10-03-2009, 05:46 AM



Theme © iAndrew 2016 - Forum software by © MyBB