Skip to content
This repository has been archived by the owner on Nov 2, 2020. It is now read-only.

Commit

Permalink
perf(Session_Log): Use insert with select to log session
Browse files Browse the repository at this point in the history
  • Loading branch information
Rhilip committed Jan 27, 2020
1 parent 8fced36 commit d786243
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
<a name="unreleased"></a>
## [Unreleased]

### Build
- **PHP:** bump PHP major version to min 7.4 (d5b1ff1)

### Chore
- **composer:** bump adhocore/cli (6647c9d)

Expand Down
7 changes: 2 additions & 5 deletions application/Components/Auth.php
Original file line number Diff line number Diff line change
Expand Up @@ -164,11 +164,8 @@ private function logSessionInfo()
])->execute();

// Insert Table `session_log`
$sid = app()->pdo->createCommand('SELECT `id` FROM `sessions` WHERE `session` = :jit')->bindParams([
'jit' => $this->cur_user_jit
])->queryScalar();
app()->pdo->createCommand('INSERT INTO `session_log` (`sid`, `access_at`, `access_ip`, `user_agent`) VALUES (:sid, NOW(), INET6_ATON(:access_ip), :ua)')->bindParams([
'sid' => $sid, 'access_ip' => $now_ip, 'ua' => $ua
app()->pdo->createCommand('INSERT INTO `session_log` (`sid`, `access_at`, `access_ip`, `user_agent`) VALUES ((SELECT `id` FROM `sessions` WHERE `session` = :jit), NOW(), INET6_ATON(:access_ip), :ua)')->bindParams([
'jit' => $this->cur_user_jit, 'access_ip' => $now_ip, 'ua' => $ua
])->execute();
}
}
Expand Down

0 comments on commit d786243

Please sign in to comment.