Skip to content

Commit

Permalink
fix: Prevent duplicate sessions in DB
Browse files Browse the repository at this point in the history
  • Loading branch information
kumy committed Jul 20, 2024
1 parent b68e220 commit 3ce19b7
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions website/app/GeoKrety/Session.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,14 @@ public function write($id, $data) {
$this->set('ip', $this->_ip);
$this->set('agent', $this->_agent);
$this->set('stamp', time() + $session_lifetime);
if ($this->dry()) {
if (!$this->dry()) {
$this->update();

return true;
}
try {
$this->insert();
} else {
} catch (\PDOException) {
$this->update();
}

Expand Down

0 comments on commit 3ce19b7

Please sign in to comment.