I've got this $user class that has a variable called $userIsSuperRoot.
When I just set error_reporting to ALL I got an error on the last line
that I'm showing of my code down below. It says this property is
undefined. Why? Just because it tests false? Why should that be an
error? You can see that I've declared it correctly. What does PHP want
here?
class McUser {
var $userName;
var $password;
var $userId;
var $dbUserId;
var $dbUserName;
var $dbPassword;
var $dbUserSecurityLevel;
var $dbIsLoggedIn;
// 06-21-03 - it would be better if this was called
$dbWhenLastCalledAPage. It keeps track
// of the most recent time this user called a page - more than 20
minutes and they are logged out.
var $dbWhenLoggedIn;
var $date;
var $userExists;
var $userIsSuperRoot;
var $userIsRoot;
var $userIsAssociate;
var $userIsJustTestingTheSite;
var $userIsVerified;
var $userIsMember;
var $sql;
var $io;
function McUser(&$sql, &$io, &$config) {
$this->sql= &$sql;
$this->io= &$io;
// 06-22-03 - these are the values from the config file. These are
the root level values.
$mcPassword = $config["mcPassword"];
$mcUserName = $config["mcUserName"];
// 06-21-03 - these next 3 values are being retrieved from COOKIES
or POST information.
$this->username = getVar("username");
$this->password = getVar("password");
$this->userId = getVar("userId");
// 07-11-03 - wasteful of resources - here we have two lines and we
make two calls to the database for the same entry.
$entry = $this->sql->getEntryWith2Conditions("cbPassword",
$this->password, "cbUserName", $this->username);
if ($entry) extract($rwArray=$this->sql->putEntryIntoNamedArray($entry));
// 06-21-03 - these next values are the ones in the database. They
need to match the ones
// the user has given or we must suspect the user is a hacker trying
to break in. Or they mistyped.
$this->userId = $cbId;
$this->dbUserId = $cbId;
$this->dbUserName = $cbUserName;
$this->dbPassword = $cbPassword;
$this->dbUserSecurityLevel = $cbUserSecurityLevel;
$this->dbIsLoggedIn = $cbIsLoggedIn;
$this->dbWhenLoggedIn = $cbWhenLoggedIn;
if ($this->password == $mcPassword && $this->username ==
$mcUserName) $this->userIsSuperRoot = true;
if ($this->dbUserSecurityLevel == "root") $this->userIsRoot = true;
if ($this->dbUserSecurityLevel == "associate")
$this->userIsAssociate = true;
if ($this->dbUserSecurityLevel == "justTestingTheSite")
$this->userIsJustTestingTheSite = true;
if ($this->dbUserSecurityLevel == "verified") $this->userIsVerified
= true;
if ($this->dbUserSecurityLevel == "member") $this->userIsMember =
true;
if (is_integer($this->dbUserId) || $this->userIsRoot) $userExists =
true;
// 06-22-03 - this is a bit of a cheat. The SQL class needs to put
someone is as the user on
// every INSERT, and root has no database value. So if the root user
is logged in, here we put
// those values in.
if ($this->userIsSuperRoot) {