Code: Select all
<?php
/**
* FR_User
*
* @author Joe Stump <joe@joestump.net>
* @copyright Joe Stump <joe@joestump.net>
* @license http://www.opensource.org/licenses/gpl-license.php
* @package Framework
* @filesource
*/
/**
* FR_User
*
* Base user object.
*
* @author Joe Stump <joe@joestump.net>
* @package Framework
*/
class FR_User extends FR_Object_DB
{
public $userID;
public $email;
public $password;
public $fname;
public $lname;
public $posted;
public function __construct($userID=null)
{
parent::__construct();
if ($userID === null) {
$session = FR_Session::singleton();
if (!is_numeric($session->userID)) {
$userID = 0;
} else {
$userID = $session->userID;
}
}
$sql = "SELECT *
FROM fr_users
WHERE userID=".$userID." AND
status='active'";
$result = $this->db->getRow($sql);
if (!PEAR::isError($result) && is_array($result)) {
$this->setFrom($result);
}
}
public function __destruct()
{
parent::__destruct();
}
}
?>hi there can someone explain this line of code ;
(!is_numeric($session->userID) , idont understand the arrow sign
does it check if the session is not numeric or if the userID is not numeric ?
so it assumes that the user is not logged in and assigns userID = 0?
Notice that the constructor looks around for user IDs in various forms. If it receives a user ID, the class fetches the given user ID. If it does not receive a user ID, it checks the session; if a user ID is not present, it assumes the user is not logged in and it loads the special anonymous user record.
The special anonymous user allows me to have a special user for people not logged in. It allows me to easily and quickly check whether a user is logged in:
(!is_numeric($session->userID)