Beste phphulpers,
Ik heb het volgende stukje code geschreven:
<?php
include('common.php');
include('classes/usersystem.php');
//de init fase
if (!isset($_SESSION['usersystem']))
$_SESSION['usersystem']=new usersystem();
//zijn we ingelogd?
if ($_SESSION['usersystem']->is_loggedin()==false)
echo'loginform';
else
echo'het systeem';
?>
<?php
class usersystem
{
private $username=false;
//returned true of false of de gebruiker wel/niet is ingelogd
function is_loggedin()
{
if ($this->username==false)
return false;
else
return true;
}
}
?>
Maar nu krijg ik deze error:
The script tried to execute a method or access a property of an incomplete object. Please ensure that the class definition "usersystem" 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....
Nu heb ik het volgende geprobeerd toe te voegen:
<?php
function __autoload($class_name)
{
require_once 'classes/'.$class_name . '.php';
}?>
Maar dit mocht niet baten.
Wat doe ik fout?
1.254 views