[eluser]xtremer360[/eluser]
I am coming across a weird error message that I've never come across before. When I load my login page I get the following error.
Code:
A PHP Error was encountered
Severity: Notice
Message: Undefined property: Login::$agent
Filename: libraries/Template.php
Line Number: 122
I am using Phil Sturgeon's template library for my codeigniter application. It is currently autoloaded. I've included the hook that I am using for my system because if I keep it I get the error message. If I comment it out then I don't get the error message. To the best of my knowledge there is no error with its 7 lines of code or the sys_prescript.php file.
application/config/hooks.php
Code:
$hook['pre_controller'] = array(
'class' => 'Sys_prescript',
'function' => 'is_logged_in',
'filename' => 'sys_prescript.php',
'filepath' => 'controllers',
'params' => ''
);
application/controllers/sys_prescript.php
Code:
<?php
if (!defined('BASEPATH'))
exit('No direct script access allowed');
class Sys_prescript extends CI_Controller {
public function __construct() {
parent::__construct();
}
public function is_logged_in()
{
$public_access = array('login', 'registration');
if (!in_array($this->router->fetch_class(), $public_access))
{
$user_id = $this -> session -> userdata('user_id');
if (($user_id == FALSE) || (is_numeric($user_id) == FALSE) && (strlen($user_id) < 5))
{
redirect('login');
}
}
}
}
application/controllers/login.php
Code:
<?php
if (!defined('BASEPATH'))
exit('No direct script access allowed');
class Login extends CI_Controller
{
public function __construct()
{
parent::__construct();
$this -> load -> model('user_login_model', 'login');
}
public function index()
{
$this -> template -> set_theme('saturn') -> set_layout(FALSE) -> build('admin/login');
}
}