Skip to content

Commit

Permalink
Merge pull request #108 from inada-s/fix-is-banned
Browse files Browse the repository at this point in the history
fix sql for IsBanned
  • Loading branch information
inada-s authored May 30, 2021
2 parents 7c909de + 20771d4 commit 302ca61
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions gdxsv/db_sqlite.go
Original file line number Diff line number Diff line change
Expand Up @@ -602,9 +602,9 @@ func (db SQLiteDB) GetString(key string) (string, error) {
func (db SQLiteDB) IsBanned(ip, cpuid string) (bool, error) {
banned := 0
err := db.QueryRowx(`SELECT 1 FROM account WHERE
(last_login_ip = ? OR (last_login_cpuid <> "" AND last_login_cpuid = ?)) AND
(SELECT login_key FROM user WHERE user_id IN (SELECT key FROM m_ban WHERE datetime() < until)) = login_key
LIMIT 1`, ip, cpuid).Scan(&banned)
(last_login_ip = ? OR ( last_login_cpuid <> "" AND last_login_cpuid = ?)) AND
(login_key IN (SELECT login_key FROM user WHERE user_id IN (SELECT key FROM m_ban WHERE datetime() < until))) LIMIT 1`,
ip, cpuid).Scan(&banned)
if err == sql.ErrNoRows {
return false, nil
}
Expand Down

0 comments on commit 302ca61

Please sign in to comment.