Welcome Guest, Not a member yet? Register   Sign In
Call to a member function userdata() on a non-object
#1

[eluser]djkemical[/eluser]
Hi everybody
I have a code that give me this error
Code:
Call to a member function userdata() on a non-object in C:\wamp\www\ci\application\libraries\centinela.php on line 19
I have no idea why give me this error...
The code of centinela.php is
Code:
<?php
if(!defined('BASEPATH'))
    exit('No direct script access allowed');

class Centinela extends CI_Controller
{

    var $_user = "";
    var $_password = "";

    var $_auth = FALSE;

    function Centinela($auto = TRUE)
    {
        if($auto)
        {
            $CI =& get_instance();

            if($this->login($CI->session->userdata('user'), $CI->session->userdata('password')))
            {
                $this->_user = $CI->session->userdata('user');
                $this->_password = $CI->session->userdata('password');
            }
        }
    }
    function getUser(){return $this->_user;}
    function getPassword(){return $this->_password;}
    function login($user = "", $password = "")
    {
        if(empty($user)||empty($password))
            return FALSE;

        $CI =& get_instance();        

        $sql = "SELECT * FROM `usuarios` WHERE `user`=? AND `password`=?";
        $query = $CI->db->query($sql, array($user, $password));

        //login ok
        if($query->affected_rows()==1)
        {
            $row = $query->row();

            $CI->session->set_userdata('user', $user);
            $this->_user = $user;
            $CI->session->set_userdata('password', $password);
            $this->_password = $row->password;

            $this->_auth = TRUE;

            return TRUE;
        }
        else
        {
            $this->_auth = FALSE;
            $this->logout();

            return FALSE;
        }
    }
    function logout()
    {
        $CI =& get_instance();
        $CI->session->sess_destroy();
        $this->_auth = FALSE;
    }
}
?>
Thanks in advance


Messages In This Thread
Call to a member function userdata() on a non-object - by El Forum - 05-09-2011, 02:46 PM
Call to a member function userdata() on a non-object - by El Forum - 05-09-2011, 03:34 PM
Call to a member function userdata() on a non-object - by El Forum - 05-11-2011, 03:58 AM
Call to a member function userdata() on a non-object - by El Forum - 05-11-2011, 04:03 AM
Call to a member function userdata() on a non-object - by El Forum - 05-11-2011, 04:11 AM
Call to a member function userdata() on a non-object - by El Forum - 05-11-2011, 07:29 AM
Call to a member function userdata() on a non-object - by El Forum - 05-11-2011, 07:47 AM
Call to a member function userdata() on a non-object - by El Forum - 05-11-2011, 08:10 AM
Call to a member function userdata() on a non-object - by El Forum - 06-07-2011, 08:03 AM
Call to a member function userdata() on a non-object - by El Forum - 06-07-2011, 08:18 AM
Call to a member function userdata() on a non-object - by El Forum - 06-07-2011, 09:40 AM
Call to a member function userdata() on a non-object - by El Forum - 06-07-2011, 09:43 AM
Call to a member function userdata() on a non-object - by El Forum - 06-07-2011, 09:51 AM
Call to a member function userdata() on a non-object - by El Forum - 08-13-2011, 03:34 PM
Call to a member function userdata() on a non-object - by El Forum - 08-13-2011, 06:05 PM



Theme © iAndrew 2016 - Forum software by © MyBB