Пример #1
0
 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());
     }
 }
Пример #2
0
 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;
 }
Пример #3
0
 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);
     }
 }