deal with dates correctly
This commit is contained in:
		
							parent
							
								
									e04b43f0ad
								
							
						
					
					
						commit
						2f4128beeb
					
				| @ -7,6 +7,10 @@ ini_set("session.cookie_lifetime", $__SESSION_TIMEOUT); | |||||||
| final class UserController | final class UserController | ||||||
| { | { | ||||||
| 
 | 
 | ||||||
|  |     private static function currentDate(){ | ||||||
|  |         return date("Y-m-d H:i:s"); | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|     public function loginAction(Array $A_urlParams = null, Array $A_postParams = null, Array $A_getParams = null) |     public function loginAction(Array $A_urlParams = null, Array $A_postParams = null, Array $A_getParams = null) | ||||||
|     { |     { | ||||||
|         if (Session::is_login()) { |         if (Session::is_login()) { | ||||||
| @ -53,6 +57,9 @@ final class UserController | |||||||
|             return header("Location: /user/login"); |             return header("Location: /user/login"); | ||||||
|         } |         } | ||||||
| 
 | 
 | ||||||
|  |         $O_user->S_LAST_SEEN = self::currentDate(); | ||||||
|  |         $O_user->update(); | ||||||
|  | 
 | ||||||
|         Session::set_login($O_user->I_ID); |         Session::set_login($O_user->I_ID); | ||||||
|          |          | ||||||
|         self::redirectToPreviousPage($A_postParams); |         self::redirectToPreviousPage($A_postParams); | ||||||
|  | |||||||
| @ -45,10 +45,11 @@ final class UserModel extends UserSessionModel | |||||||
|      |      | ||||||
|     public function insert(){ |     public function insert(){ | ||||||
|         $O_model = Model::get(); |         $O_model = Model::get(); | ||||||
|         $stmt = $O_model->prepare("INSERT INTO USER (EMAIL, USERNAME, PASS_HASH, FIRST_SEEN) VALUES(:email, :username, :password_hash, :first_seen)"); |         $stmt = $O_model->prepare("INSERT INTO USER (EMAIL, USERNAME, PASS_HASH, FIRST_SEEN, LAST_SEEN) VALUES(:email, :username, :password_hash, :first_seen, :last_seen)"); | ||||||
|         $stmt->bindParam("email", $this->S_EMAIL); |         $stmt->bindParam("email", $this->S_EMAIL); | ||||||
|         $stmt->bindParam("username", $this->S_USERNAME); |         $stmt->bindParam("username", $this->S_USERNAME); | ||||||
|         $stmt->bindParam("password_hash", $this->S_PASSWORD_HASH); |         $stmt->bindParam("password_hash", $this->S_PASSWORD_HASH); | ||||||
|  |         $stmt->bindParam("last_seen", $this->S_LAST_SEEN); | ||||||
|         $stmt->bindParam("first_seen", $this->S_FIRST_SEEN); |         $stmt->bindParam("first_seen", $this->S_FIRST_SEEN); | ||||||
|         $stmt->execute(); |         $stmt->execute(); | ||||||
|         $this->I_ID = Model::get()->lastInsertId(); |         $this->I_ID = Model::get()->lastInsertId(); | ||||||
|  | |||||||
		Loading…
	
		Reference in New Issue
	
	Block a user