Welcome Guest, Not a member yet? Register   Sign In
problam with my admin library
#1

[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
#2

[eluser]Michael Wales[/eluser]
you are trying to load a model somewhere within that file that is name improperly.
#3

[eluser]A.M.F[/eluser]
[quote author="walesmd" date="1196005984"]you are trying to load a model somewhere within that file that is name improperly.[/quote]

that what i thought too, but i don't!
the class that u see above is the only thing inside my library.




Theme © iAndrew 2016 - Forum software by © MyBB