22{
25
27 "SELECT a.id, a.username, a.locked, a.lock_country, a.last_ip, a.failed_logins, "
28 "ab.unbandate > UNIX_TIMESTAMP() OR ab.unbandate = ab.bandate, ab.unbandate = ab.bandate, "
29 "ipb.unbandate > UNIX_TIMESTAMP() OR ipb.unbandate = ipb.bandate, ipb.unbandate = ipb.bandate, "
30 "aa.gmlevel, a.totp_secret, a.salt, a.verifier "
31 "FROM account a "
32 "LEFT JOIN account_access aa ON a.id = aa.id "
33 "LEFT JOIN account_banned ab ON ab.id = a.id AND ab.active = 1 "
34 "LEFT JOIN ip_banned ipb ON ipb.ip = ? "
37 "SELECT a.id, a.username, a.locked, a.lock_country, a.last_ip, a.failed_logins, "
38 "ab.unbandate > UNIX_TIMESTAMP() OR ab.unbandate = ab.bandate, ab.unbandate = ab.bandate, "
39 "ipb.unbandate > UNIX_TIMESTAMP() OR ipb.unbandate = ipb.bandate, ipb.unbandate = ipb.bandate, "
40 "aa.gmlevel, a.session_key "
41 "FROM account a "
42 "LEFT JOIN account_access aa ON a.id = aa.id "
43 "LEFT JOIN account_banned ab ON ab.id = a.id AND ab.active = 1 "
44 "LEFT JOIN ip_banned ipb ON ipb.ip = ? "
46 PrepareStatement(
LOGIN_SEL_ACCOUNT_INFO_BY_NAME,
"SELECT a.id, a.session_key, a.last_ip, a.locked, a.lock_country, a.expansion, a.mutetime, a.locale, a.recruiter, a.os, a.totaltime, "
47 "aa.gmlevel, ab.unbandate > UNIX_TIMESTAMP() OR ab.unbandate = ab.bandate, r.id FROM account a LEFT JOIN account_access aa ON a.id = aa.id AND aa.RealmID IN (-1, ?) "
48 "LEFT JOIN account_banned ab ON a.id = ab.id AND ab.active = 1 LEFT JOIN account r ON a.id = r.recruiter WHERE a.username = ? "
49 "AND a.session_key IS NOT NULL ORDER BY aa.RealmID DESC LIMIT 1",
CONNECTION_ASYNC);
51 PrepareStatement(
LOGIN_SEL_REALMLIST,
"SELECT id, name, address, localAddress, localSubnetMask, port, icon, flag, timezone, allowedSecurityLevel, population, gamebuild FROM realmlist WHERE flag <> 3 ORDER BY name",
CONNECTION_SYNCH);
55 PrepareStatement(
LOGIN_INS_IP_AUTO_BANNED,
"INSERT INTO ip_banned (ip, bandate, unbandate, bannedby, banreason) VALUES (?, UNIX_TIMESTAMP(), UNIX_TIMESTAMP()+?, 'realmd', 'Failed login autoban')",
CONNECTION_ASYNC);
74 PrepareStatement(
LOGIN_INS_IP_BANNED,
"INSERT INTO ip_banned (ip, bandate, unbandate, bannedby, banreason) VALUES (?, UNIX_TIMESTAMP(), UNIX_TIMESTAMP()+?, ?, ?)",
CONNECTION_ASYNC);
81 PrepareStatement(
LOGIN_INS_ACCOUNT,
"INSERT INTO account(username, salt, verifier, expansion, joindate) VALUES(?, ?, ?, ?, NOW())",
CONNECTION_ASYNC);
104 PrepareStatement(
LOGIN_SEL_PINFO,
"SELECT a.username, aa.gmlevel, a.email, a.reg_mail, a.last_ip, DATE_FORMAT(a.last_login, '%Y-%m-%d %T'), a.mutetime, a.mutereason, a.muteby, a.failed_logins, a.locked, a.OS FROM account a LEFT JOIN account_access aa ON (a.id = aa.id AND (aa.RealmID = ? OR aa.RealmID = -1)) WHERE a.id = ?",
CONNECTION_SYNCH);
125
126 PrepareStatement(
LOGIN_INS_ALDL_IP_LOGGING,
"INSERT INTO logs_ip_actions (account_id,character_guid,type,ip,systemnote,unixtime,time) VALUES (?, ?, ?, (SELECT last_ip FROM account WHERE id = ?), ?, unix_timestamp(NOW()), NOW())",
CONNECTION_ASYNC);
127
128 PrepareStatement(
LOGIN_INS_FACL_IP_LOGGING,
"INSERT INTO logs_ip_actions (account_id,character_guid,type,ip,systemnote,unixtime,time) VALUES (?, ?, ?, (SELECT last_attempt_ip FROM account WHERE id = ?), ?, unix_timestamp(NOW()), NOW())",
CONNECTION_ASYNC);
129
130 PrepareStatement(
LOGIN_INS_CHAR_IP_LOGGING,
"INSERT INTO logs_ip_actions (account_id,character_guid,type,ip,systemnote,unixtime,time) VALUES (?, ?, ?, ?, ?, unix_timestamp(NOW()), NOW())",
CONNECTION_ASYNC);
131
132 PrepareStatement(
LOGIN_INS_FALP_IP_LOGGING,
"INSERT INTO logs_ip_actions (account_id,character_guid,type,ip,systemnote,unixtime,time) VALUES (?, 0, 1, ?, ?, unix_timestamp(NOW()), NOW())",
CONNECTION_ASYNC);
133
134
135 PrepareStatement(
LOGIN_INS_LOG,
"INSERT INTO logs (time, realm, type, level, string) VALUES (?, ?, ?, ?, ?)",
CONNECTION_ASYNC);
136
137
141
144
146}
@ LOGIN_UPD_MUTE_TIME_LOGIN
Definition: LoginDatabase.h:73
@ LOGIN_INS_ACCOUNT_BANNED
Definition: LoginDatabase.h:60
@ LOGIN_SEL_ACCOUNT_LIST_BY_EMAIL
Definition: LoginDatabase.h:51
@ LOGIN_INS_ACCOUNT_AUTO_BANNED
Definition: LoginDatabase.h:40
@ LOGIN_INS_LOG
Definition: LoginDatabase.h:115
@ LOGIN_UPD_EMAIL
Definition: LoginDatabase.h:70
@ LOGIN_SEL_ACCOUNT_BY_IP
Definition: LoginDatabase.h:54
@ LOGIN_DEL_ACCOUNT_ACCESS_BY_REALM
Definition: LoginDatabase.h:80
@ LOGIN_GET_ACCOUNT_ID_BY_USERNAME
Definition: LoginDatabase.h:82
@ LOGIN_UPD_UPTIME_PLAYERS
Definition: LoginDatabase.h:77
@ LOGIN_SEL_LAST_ATTEMPT_IP
Definition: LoginDatabase.h:104
@ LOGIN_DEL_IP_NOT_BANNED
Definition: LoginDatabase.h:56
@ LOGIN_SEL_ACCOUNT_BY_ID
Definition: LoginDatabase.h:59
@ LOGIN_INS_ALDL_IP_LOGGING
Definition: LoginDatabase.h:106
@ LOGIN_DEL_ACCOUNT_MUTED
Definition: LoginDatabase.h:113
@ LOGIN_REP_REALM_CHARACTERS
Definition: LoginDatabase.h:63
@ LOGIN_DEL_ACCOUNT_BANNED
Definition: LoginDatabase.h:41
@ LOGIN_DEL_EXPIRED_IP_BANS
Definition: LoginDatabase.h:32
@ LOGIN_SEL_CHECK_PASSWORD_BY_NAME
Definition: LoginDatabase.h:87
@ LOGIN_SEL_BANS
Definition: LoginDatabase.h:95
@ LOGIN_SEL_PINFO
Definition: LoginDatabase.h:88
@ LOGIN_INS_MOTD_LOCALE
Definition: LoginDatabase.h:103
@ MAX_LOGINDATABASE_STATEMENTS
Definition: LoginDatabase.h:126
@ LOGIN_UPD_ACCOUNT_TOTP_SECRET
Definition: LoginDatabase.h:122
@ LOGIN_SEL_IP_BANNED
Definition: LoginDatabase.h:35
@ LOGIN_UPD_LAST_ATTEMPT_IP
Definition: LoginDatabase.h:75
@ LOGIN_DEL_ACCOUNT_ACCESS
Definition: LoginDatabase.h:79
@ LOGIN_SEL_ACCOUNT_WHOIS
Definition: LoginDatabase.h:96
@ LOGIN_SEL_MOTD_LOCALE
Definition: LoginDatabase.h:101
@ LOGIN_UPD_USERNAME
Definition: LoginDatabase.h:71
@ LOGIN_INS_IP_BANNED
Definition: LoginDatabase.h:55
@ LOGIN_SEL_SECRET_DIGEST
Definition: LoginDatabase.h:117
@ LOGIN_SEL_REALMLIST
Definition: LoginDatabase.h:31
@ LOGIN_SEL_IP_BANNED_BY_IP
Definition: LoginDatabase.h:58
@ LOGIN_GET_GMLEVEL_BY_REALMID
Definition: LoginDatabase.h:84
@ LOGIN_UPD_EXPANSION
Definition: LoginDatabase.h:67
@ LOGIN_UPD_ACCOUNT_LOCK_COUNTRY
Definition: LoginDatabase.h:69
@ LOGIN_SEL_REALMLIST_SECURITY_LEVEL
Definition: LoginDatabase.h:97
@ LOGIN_INS_SECRET_DIGEST
Definition: LoginDatabase.h:118
@ LOGIN_SEL_ACCOUNT_MUTE_INFO
Definition: LoginDatabase.h:112
@ LOGIN_UPD_ACCOUNT_NOT_BANNED
Definition: LoginDatabase.h:61
@ LOGIN_SEL_GM_ACCOUNTS
Definition: LoginDatabase.h:90
@ LOGIN_UPD_LOGON
Definition: LoginDatabase.h:42
@ LOGIN_SEL_ACCOUNT_LIST_BY_NAME
Definition: LoginDatabase.h:49
@ LOGIN_SEL_ACCOUNT_TOTP_SECRET
Definition: LoginDatabase.h:121
@ LOGIN_INS_FALP_IP_LOGGING
Definition: LoginDatabase.h:109
@ LOGIN_UPD_MUTE_TIME
Definition: LoginDatabase.h:72
@ LOGIN_UPD_LAST_IP
Definition: LoginDatabase.h:74
@ LOGIN_UPD_LOGONPROOF
Definition: LoginDatabase.h:43
@ LOGIN_UPD_ACCOUNT_LOCK
Definition: LoginDatabase.h:68
@ LOGIN_SEL_AUTOBROADCAST
Definition: LoginDatabase.h:99
@ LOGIN_SEL_SUM_REALM_CHARACTERS
Definition: LoginDatabase.h:64
@ LOGIN_UPD_ACCOUNT_ONLINE
Definition: LoginDatabase.h:76
@ LOGIN_GET_USERNAME_BY_ID
Definition: LoginDatabase.h:85
@ LOGIN_DEL_ACCOUNT
Definition: LoginDatabase.h:98
@ LOGIN_SEL_LAST_IP
Definition: LoginDatabase.h:105
@ LOGIN_SEL_FAILEDLOGINS
Definition: LoginDatabase.h:47
@ LOGIN_INS_REALM_CHARACTERS_INIT
Definition: LoginDatabase.h:66
@ LOGIN_SEL_IP_INFO
Definition: LoginDatabase.h:34
@ LOGIN_SEL_NUM_CHARS_ON_REALM
Definition: LoginDatabase.h:52
@ LOGIN_DEL_SECRET_DIGEST
Definition: LoginDatabase.h:119
@ LOGIN_UPD_EXPIRED_ACCOUNT_BANS
Definition: LoginDatabase.h:33
@ LOGIN_SEL_ACCOUNT_BANNED_BY_USERNAME
Definition: LoginDatabase.h:39
@ LOGIN_INS_FACL_IP_LOGGING
Definition: LoginDatabase.h:107
@ LOGIN_INS_CHAR_IP_LOGGING
Definition: LoginDatabase.h:108
@ LOGIN_SEL_RECONNECTCHALLENGE
Definition: LoginDatabase.h:45
@ LOGIN_INS_ACCOUNT_ACCESS
Definition: LoginDatabase.h:81
@ LOGIN_DEL_REALM_CHARACTERS
Definition: LoginDatabase.h:62
@ LOGIN_SEL_CHECK_PASSWORD
Definition: LoginDatabase.h:86
@ LOGIN_SEL_PINFO_BANS
Definition: LoginDatabase.h:89
@ LOGIN_SEL_ACCOUNT_ID_BY_NAME
Definition: LoginDatabase.h:48
@ LOGIN_UPD_FAILEDLOGINS
Definition: LoginDatabase.h:46
@ LOGIN_SEL_ACCOUNT_ACCESS
Definition: LoginDatabase.h:93
@ LOGIN_INS_MOTD
Definition: LoginDatabase.h:102
@ LOGIN_SEL_IP_BANNED_ALL
Definition: LoginDatabase.h:57
@ LOGIN_SEL_ACCOUNT_RECRUITER
Definition: LoginDatabase.h:94
@ LOGIN_INS_IP_AUTO_BANNED
Definition: LoginDatabase.h:36
@ LOGIN_SEL_ACCOUNT_INFO
Definition: LoginDatabase.h:91
@ LOGIN_SEL_ACCOUNT_BANNED
Definition: LoginDatabase.h:37
@ LOGIN_SEL_LOGONCHALLENGE
Definition: LoginDatabase.h:44
@ LOGIN_SEL_ACCOUNT_ACCESS_GMLEVEL_TEST
Definition: LoginDatabase.h:92
@ LOGIN_DEL_OLD_LOGS
Definition: LoginDatabase.h:78
@ LOGIN_SEL_ACCOUNT_BANNED_ALL
Definition: LoginDatabase.h:38
@ LOGIN_GET_ACCOUNT_ACCESS_GMLEVEL
Definition: LoginDatabase.h:83
@ LOGIN_SEL_REALM_CHARACTER_COUNTS
Definition: LoginDatabase.h:53
@ LOGIN_SEL_MOTD
Definition: LoginDatabase.h:100
@ LOGIN_SEL_ACCOUNT_INFO_BY_NAME
Definition: LoginDatabase.h:50
@ LOGIN_INS_ACCOUNT_MUTE
Definition: LoginDatabase.h:111
@ LOGIN_INS_UPTIME
Definition: LoginDatabase.h:124
@ LOGIN_INS_ACCOUNT
Definition: LoginDatabase.h:65
@ CONNECTION_SYNCH
Definition: MySQLConnection.h:38
@ CONNECTION_ASYNC
Definition: MySQLConnection.h:37
void PrepareStatement(uint32 index, std::string_view sql, ConnectionFlags flags)
Definition: MySQLConnection.cpp:505
PreparedStatementContainer m_stmts
Definition: MySQLConnection.h:105
bool m_reconnecting
PreparedStatements storage.
Definition: MySQLConnection.h:106