Uczę się kohana 2.3.4, chcę zrobić logowanie i ale nie działa i nie wiem co robię źle. Mam taki kod:
class Auth_Controller extends Home_Controller {
public function __construct()
{
parent::__construct();
$this-> session = Session:: instance();
$this-> auth = Auth :: instance();
}
public function index()
{
}
public function login()
{
if ($this->auth->logged_in())
{
url::redirect($this->session->get("requested_url"));
}
else
{
if ($this->auth->logged_in()){
}else{
//$template->title="Please Login";
$this->template = new View('template');
$this->template->tresc= new View('login');
$this->template->render(TRUE);
}
}
}
public function login2() {
$username = $this->input->post('username');
$password = $this->input->post('password');
$user = ORM::factory('user', $username);
Auth::instance()->login($user->username, $password);
echo html
::anchor('auth/logout', 'wyloguj!');
if ($this->auth->logged_in())
else
}
}
class Home_Controller extends Controller {
public $template;
public $session;
public $auth;
public function __construct()
{
parent::__construct();
}
public function index()
{
$this->template = new View('template');
$this->template->tresc = new View('glowna/index');
$this->template->render(TRUE);
}
}
Czy mógłby ktoś na to spojrzeć? Po logowaniu ten fragment
if ($this->auth->logged_in())
else
Ciągle zwraca 5, czyli chyba user nie jest zalogowany? Co robię źle że nie chce logować?
Dzięki za pomoc.
Jakby była potrzeba pokazać pliki widoków to napiszcie .
Ten post edytował wald3k 12.10.2010, 20:15:03