File tree Expand file tree Collapse file tree 1 file changed +10
-1
lines changed Expand file tree Collapse file tree 1 file changed +10
-1
lines changed Original file line number Diff line number Diff line change @@ -188,15 +188,24 @@ protected static function lookup(string $key) {
188188 Common::$ database = DatabaseDriver::getDatabaseObject ();
189189 }
190190
191+ $ dt_now_str = (new DateTime (
192+ 'now ' , new DateTimeZone ('Etc/UTC ' )
193+ ))->format (self ::DATE_SQL );
194+
191195 $ fingerprint = false ;
192196
193197 try {
194198 $ stmt = Common::$ database ->prepare ('
195199 SELECT `user_id`, `ip_address`, `user_agent`
196- FROM `user_sessions` WHERE `id` = :id LIMIT 1;
200+ FROM `user_sessions`
201+ WHERE `id` = :id AND (
202+ `expires_datetime` = NULL OR
203+ :dt < `expires_datetime`
204+ ) LIMIT 1;
197205 ' );
198206
199207 $ stmt ->bindParam (':id ' , $ key , PDO ::PARAM_STR );
208+ $ stmt ->bindParam (':dt ' , $ dt_now_str , PDO ::PARAM_STR );
200209
201210 $ r = $ stmt ->execute ();
202211
You can’t perform that action at this time.
0 commit comments