[eluser]A.M.F[/eluser]
hello,
i created a library that should confirm if the user is an admin or not. so my library class looks like this-
Code:
$admin_auth = new admin_func;
class Admin_func {
var $adm_id = 0;
//
//Checks for authorization
//
function auth() {
$object =& get_instance();
if (($object->session->userdata('id')) && ($object->session->userdata('user')))
{
$id_session = $object->session->userdata('id');
$user_session = $object->session->userdata('user');
$query = $object->db->query("SELECT * FROM `admin_users` WHERE `id`='{$id_session}'");
if ($query->num_rows() == 1)
{
$y = $query->row();
@extract($y);
}
if ($password == $user_session)
{
$this->adm_id = $id;
return true;
}
else
{
return false;
die("אינך מורשה!");
}
}
else
{
return false;
die("אינך מורשה!");
}
}
}
then i an loading it with my controlloer and use the function like this-
Code:
$this->load->library('admin');
if (!$this->admin_auth->auth()) die();
but i keep getting the same error-
Quote:A PHP Error was encountered
Severity: Notice
Message: Undefined property: Admin::$layoutmodel
Filename: libraries/Loader.php
Line Number: 921
Fatal error: Call to a member function _assign_libraries() on a non-object in D:\wamp\www\ci\system\libraries\Loader.php on line 921
what should i do?
- thanks