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

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
stevestark5000
Forum Commoner
Posts: 61
Joined: Thu Jan 27, 2011 12:08 am

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

Post 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();
}
}
cpetercarter
Forum Contributor
Posts: 474
Joined: Sat Jul 25, 2009 2:00 am

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

Post 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.
stevestark5000
Forum Commoner
Posts: 61
Joined: Thu Jan 27, 2011 12:08 am

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

Post by stevestark5000 »

i figured it out. thank you
Post Reply