Page 1 of 1

Call to a member function isUser() on a non-object on line 7

Posted: Thu Jan 27, 2011 12:17 am
by stevestark5000
the $GLOBALS['core']->killAllSessions(); in the following code is not working. the code works good without it but i need it to work. is there another way to write it?

the error i get with $GLOBALS['core']->killAllSessions(); in the code is at the topic of this message.

if (!isset($GLOBALS['core'])){
header("location:../../");
exit();
}
$GLOBALS['core']->killAllSessions();
if (!$_SESSION['OBJ_user']->isUser()) {
$settings = $_SESSION["OBJ_user"]->getSettings();

if($settings["show_remember_me"])
$myCookie = PHPWS_User_Cookie::cookie_read("mod_users", "rememberme");

if(isset($myCookie)) {
$myCookie = preg_replace('/\W/', '', $myCookie);
$id = $GLOBALS["core"]->getOne("select user_id from mod_users where cookie='$myCookie'", TRUE);
if($id)
$_SESSION['OBJ_user']->loadUser($id, 1);
else
PHPWS_User::login_box();
} else {
PHPWS_User::login_box();
}
}

Re: Call to a member function isUser() on a non-object on li

Posted: Thu Jan 27, 2011 12:55 am
by cpetercarter
Could be that

Code: Select all

$GLOBALS['core']->killAllSessions();
destroys the session variables, so that the object $_SESSION['OBJ_user'] called in the next line no longer exists.

Re: Call to a member function isUser() on a non-object on li

Posted: Thu Jan 27, 2011 1:18 am
by stevestark5000
i figured it out. thank you