• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
MY_Controller and login-authentication misunderstanding probably

#1
[eluser]blitzneo[/eluser]
Hi there, I tried, by reading every single post I found related to this, build an auth-login system.
So if I understood correctly:

I created a MY_Controller library:

<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class Auth_controller extends CI_Controller {

public $data; // creo $data apropiadamente.

public function __construct()
{
parent::__construct();

if ($this->session->userdata('logged_in') === TRUE)
{
redirect('site/index');
} else {
redirect('welcome/index');
}
}

}

then, a Login controller, extending this one

<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class Login_controller extends Auth_controller {

public function index()
{
// check user
}

}

and then, the site controller, which can be seen only if the user is logged in, otherwise, it will be the welcome one.

so my question is:
Has site controller be written this way ?

class Site extends CI_Controller {
//...
}

or this way ?

class Site extends Auth_controller {
//...
}

I ask this because I am a bit lost, after logging a user and redirecting to the 'private' site things... Thanks a lot for your help, and sorry if I missed to read this in any other post :/


Messages In This Thread
MY_Controller and login-authentication misunderstanding probably - by El Forum - 06-06-2011, 11:24 AM

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2021 MyBB Group.