private function __construct() { try { // mysql:host=127.0.0.1;dbname=coding_physics, username, password $this->pdoObject = new PDO('mysql:host=' . SettingsFactory::getSettingsProperty(SettingsFactory::$HOST_PATH) . ';dbname=' . SettingsFactory::getSettingsProperty(SettingsFactory::$DATABASE_PATH), SettingsFactory::getSettingsProperty(SettingsFactory::$USERNAME_PATH), SettingsFactory::getSettingsProperty(SettingsFactory::$PASSWORD_PATH)); } catch (PDOException $e) { die($e->getMessage()); } }
public static function check($token) { $tokenName = SettingsFactory::getSettingsProperty('session/token_name'); if (Session::sessionExists($tokenName) && $token === Session::sessionGet($tokenName)) { Session::sessionDelete($tokenName); return true; } return false; }
public function __construct($user = null) { $this->databaseController = DatabaseController::getDatabaseInstance(); $this->sessionName = SettingsFactory::getSettingsProperty(SettingsFactory::$SESSIONNAME_PATH); if (!$user) { // no arg provided if (Session::sessionExists($this->sessionName)) { $user = Session::sessionGet($this->sessionName); if ($this->find($user)) { $this->isLoggedIn = true; } } } else { $this->find($user); } }