Example #1
0
 public function pageUserLoggingListeChanged($sender, $param)
 {
     $this->UserLogging->CurrentPageIndex = $param->NewPageIndex;
     $ULSQL = "SELECT * FROM tt_user_log ORDER BY ul_time DESC LIMIT 20";
     $this->UserLogging->DataSource = TTUserLogRecord::finder()->findAllBySQL($ULSQL);
     $this->UserLogging->dataBind();
 }
Example #2
0
 /**
  * Checks if the specified (username, password) is valid.
  * This method is required by TDbUser.
  * @param string username
  * @param string password
  * @return boolean whether the username and password are valid.
  */
 public function validateUser($username, $password)
 {
     date_default_timezone_set('Europe/Berlin');
     $UserRecord = UserRecord::finder()->find('user_username = ? AND user_password = ?', $username, $password);
     if (count($UserRecord) == 1) {
         // use UserRecord Active Record to look for the (username, password) pair.
         $TempUserLog = new TTUserLogRecord();
         $TempUserLog->idtm_user = $UserRecord->idtm_user;
         $TempUserLog->ul_time = date("Y-m-d H:i:s");
         $TempUserLog->ul_status = "loggin";
         $TempUserLog->ul_ipadress = $_SERVER['HTTP_USER_AGENT'];
         $TempUserLog->save();
         return true;
     } else {
         $TempUserLog = new TTUserLogRecord();
         $TempUserLog->idtm_user = 0;
         $TempUserLog->ul_time = date("Y-m-d H:i:s");
         $TempUserLog->ul_status = "error loggin";
         $TempUserLog->ul_ipadress = $_SERVER['HTTP_USER_AGENT'];
         $TempUserLog->save();
         return false;
     }
 }