[eluser]Unknown[/eluser]
Can anyone please help me, I am getting the following error message when someone has logged in and tried to click on their profile: Fatal error:
c_login::checkSession() [<a href='c-login.checksession'>c-login.checksession</a>]: The script tried to execute a method or access a property of an incomplete object. Please ensure that the class definition "c_customer" of the object you are trying to operate on was loaded _before_ unserialize() gets called or provide a __autoload() function to load the class definition in /var/www/synced/mycactus/class/c_login.php on line 111
here is the c_login class
Code:
class c_login
{
/**
* Checks login and stores the logged user into the c_login class/SESSION
* @param $email String
* @param $password String
* @return boolean
*/
function check($email,$password,$isDebug=false)
{
$user_id = -1;
$return = false;
$handler = new c_customer_handler();
if($email && $password)
{
$user_id = $handler->isUser(Array("email"=>$email,"password"=>$password), $isDebug);
if($user_id)
{
$user = new c_customer();
$user = $handler->loadCustomerByID($user_id,"SHORTVIEW",$isDebug);
if($user->isValid())
{
c_login::setUser($user);
$return = true;
}
}
else
$return = false;
}
else
$return = false;
return $return;
}
/**
* Checks login against user class and stores the logged user into the c_login class/SESSION
* @param $email String
* @param $password String
* @return boolean
*/
function checkUser($email,$password,$isDebug=false)
{
$user_id = -1;
$return = false;
$handler = new c_user_handler();
$email = stripslashes($email);
if($email && $password)
{
$user_id = $handler->isUser(Array("email"=>$email,"password"=>$password), $isDebug);
if($user_id)
{
$user = new c_user();
$user = $handler->loadUserByID($user_id,"SHORTVIEW",$isDebug);
if($user->isValid())
{
c_login::setUser($user);
$return = true;
}
}
else
$return = false;
}
else
$return = false;
return $return;
}
/**
* Loads the full user out of the DB
* @param $usage
* @return unknown_type
*/
function loadDetails($usage="VIEW")
{
$handler = new c_customer_handler();
c_login::setUser( $handler->loadCustomerByID(c_login::user()->id, $usage) );
}
/**
* Logs the user out and cleans the session up.
*/
function logout()
{
return session_destroy();
}
/**
* Checks if a user is logged in.
* @return bool
*/
function checkSession()
{
$return = false;
if(session_id())
{
if(c_login::user()->isValid())
$return = true;
}
return $return;
}
/**
* Returns the logged user
* @return c_customer
*/
function user()
{
return !empty($_SESSION['login_user'])?$_SESSION['login_user']:new c_customer();
}
/**
* Sets the logged user
* @param $user c_customer
*/
function setUser($user)
{
$_SESSION['login_user'] = $user;
}
}