Tabs
This commit is contained in:
@@ -28,7 +28,7 @@ void LoginDatabaseConnection::DoPrepareStatements()
|
|||||||
PrepareStatement(LOGIN_UPD_VS, "UPDATE account SET v = ?, s = ? WHERE username = ?", CONNECTION_ASYNC);
|
PrepareStatement(LOGIN_UPD_VS, "UPDATE account SET v = ?, s = ? WHERE username = ?", CONNECTION_ASYNC);
|
||||||
PrepareStatement(LOGIN_UPD_LOGONPROOF, "UPDATE account SET sessionkey = ?, last_ip = ?, last_login = NOW(), locale = ?, failed_logins = 0, os = ? WHERE username = ?", CONNECTION_SYNCH);
|
PrepareStatement(LOGIN_UPD_LOGONPROOF, "UPDATE account SET sessionkey = ?, last_ip = ?, last_login = NOW(), locale = ?, failed_logins = 0, os = ? WHERE username = ?", CONNECTION_SYNCH);
|
||||||
PrepareStatement(LOGIN_SEL_LOGONCHALLENGE, "SELECT a.sha_pass_hash, a.id, a.locked, a.last_ip, aa.gmlevel, a.v, a.s FROM account a LEFT JOIN account_access aa ON (a.id = aa.id) WHERE a.username = ?", CONNECTION_SYNCH);
|
PrepareStatement(LOGIN_SEL_LOGONCHALLENGE, "SELECT a.sha_pass_hash, a.id, a.locked, a.last_ip, aa.gmlevel, a.v, a.s FROM account a LEFT JOIN account_access aa ON (a.id = aa.id) WHERE a.username = ?", CONNECTION_SYNCH);
|
||||||
PrepareStatement(LOGIN_SEL_LOGON_COUNTRY, "SELECT country FROM ip2nation WHERE ip < ? ORDER BY ip DESC LIMIT 0,1", CONNECTION_SYNCH);
|
PrepareStatement(LOGIN_SEL_LOGON_COUNTRY, "SELECT country FROM ip2nation WHERE ip < ? ORDER BY ip DESC LIMIT 0,1", CONNECTION_SYNCH);
|
||||||
PrepareStatement(LOGIN_UPD_FAILEDLOGINS, "UPDATE account SET failed_logins = failed_logins + 1 WHERE username = ?", CONNECTION_ASYNC);
|
PrepareStatement(LOGIN_UPD_FAILEDLOGINS, "UPDATE account SET failed_logins = failed_logins + 1 WHERE username = ?", CONNECTION_ASYNC);
|
||||||
PrepareStatement(LOGIN_SEL_FAILEDLOGINS, "SELECT id, failed_logins FROM account WHERE username = ?", CONNECTION_SYNCH);
|
PrepareStatement(LOGIN_SEL_FAILEDLOGINS, "SELECT id, failed_logins FROM account WHERE username = ?", CONNECTION_SYNCH);
|
||||||
PrepareStatement(LOGIN_SEL_ACCOUNT_ID_BY_NAME, "SELECT id FROM account WHERE username = ?", CONNECTION_SYNCH);
|
PrepareStatement(LOGIN_SEL_ACCOUNT_ID_BY_NAME, "SELECT id FROM account WHERE username = ?", CONNECTION_SYNCH);
|
||||||
@@ -50,7 +50,7 @@ void LoginDatabaseConnection::DoPrepareStatements()
|
|||||||
PrepareStatement(LOGIN_INS_REALM_CHARACTERS_INIT, "INSERT INTO realmcharacters (realmid, acctid, numchars) SELECT realmlist.id, account.id, 0 FROM realmlist, account LEFT JOIN realmcharacters ON acctid=account.id WHERE acctid IS NULL", CONNECTION_ASYNC);
|
PrepareStatement(LOGIN_INS_REALM_CHARACTERS_INIT, "INSERT INTO realmcharacters (realmid, acctid, numchars) SELECT realmlist.id, account.id, 0 FROM realmlist, account LEFT JOIN realmcharacters ON acctid=account.id WHERE acctid IS NULL", CONNECTION_ASYNC);
|
||||||
PrepareStatement(LOGIN_UPD_EXPANSION, "UPDATE account SET expansion = ? WHERE id = ?", CONNECTION_ASYNC);
|
PrepareStatement(LOGIN_UPD_EXPANSION, "UPDATE account SET expansion = ? WHERE id = ?", CONNECTION_ASYNC);
|
||||||
PrepareStatement(LOGIN_UPD_ACCOUNT_LOCK, "UPDATE account SET locked = ? WHERE id = ?", CONNECTION_ASYNC);
|
PrepareStatement(LOGIN_UPD_ACCOUNT_LOCK, "UPDATE account SET locked = ? WHERE id = ?", CONNECTION_ASYNC);
|
||||||
PrepareStatement(LOGIN_UPD_ACCOUNT_LOCK_CONTRY, "UPDATE account SET lock_country = ? WHERE id = ?", CONNECTION_ASYNC);
|
PrepareStatement(LOGIN_UPD_ACCOUNT_LOCK_CONTRY, "UPDATE account SET lock_country = ? WHERE id = ?", CONNECTION_ASYNC);
|
||||||
PrepareStatement(LOGIN_UPD_USERNAME, "UPDATE account SET v = 0, s = 0, username = ?, sha_pass_hash = ? WHERE id = ?", CONNECTION_ASYNC);
|
PrepareStatement(LOGIN_UPD_USERNAME, "UPDATE account SET v = 0, s = 0, username = ?, sha_pass_hash = ? WHERE id = ?", CONNECTION_ASYNC);
|
||||||
PrepareStatement(LOGIN_UPD_PASSWORD, "UPDATE account SET v = 0, s = 0, sha_pass_hash = ? WHERE id = ?", CONNECTION_ASYNC);
|
PrepareStatement(LOGIN_UPD_PASSWORD, "UPDATE account SET v = 0, s = 0, sha_pass_hash = ? WHERE id = ?", CONNECTION_ASYNC);
|
||||||
PrepareStatement(LOGIN_UPD_MUTE_TIME, "UPDATE account SET mutetime = ? , mutereason = ? , muteby = ? WHERE id = ?", CONNECTION_ASYNC);
|
PrepareStatement(LOGIN_UPD_MUTE_TIME, "UPDATE account SET mutetime = ? , mutereason = ? , muteby = ? WHERE id = ?", CONNECTION_ASYNC);
|
||||||
@@ -78,6 +78,6 @@ void LoginDatabaseConnection::DoPrepareStatements()
|
|||||||
PrepareStatement(LOGIN_SEL_ACCOUNT_WHOIS, "SELECT username, email, last_ip FROM account WHERE id = ?", CONNECTION_SYNCH);
|
PrepareStatement(LOGIN_SEL_ACCOUNT_WHOIS, "SELECT username, email, last_ip FROM account WHERE id = ?", CONNECTION_SYNCH);
|
||||||
PrepareStatement(LOGIN_SEL_REALMLIST_SECURITY_LEVEL, "SELECT allowedSecurityLevel from realmlist WHERE id = ?", CONNECTION_SYNCH);
|
PrepareStatement(LOGIN_SEL_REALMLIST_SECURITY_LEVEL, "SELECT allowedSecurityLevel from realmlist WHERE id = ?", CONNECTION_SYNCH);
|
||||||
PrepareStatement(LOGIN_DEL_ACCOUNT, "DELETE FROM account WHERE id = ?", CONNECTION_ASYNC);
|
PrepareStatement(LOGIN_DEL_ACCOUNT, "DELETE FROM account WHERE id = ?", CONNECTION_ASYNC);
|
||||||
PrepareStatement(LOGIN_SEL_IP2NATION_COUNTRY, "SELECT c.country FROM ip2nationCountries c, ip2nation i WHERE i.ip < ? AND c.code = i.country ORDER BY i.ip DESC LIMIT 0,1", CONNECTION_SYNCH);
|
PrepareStatement(LOGIN_SEL_IP2NATION_COUNTRY, "SELECT c.country FROM ip2nationCountries c, ip2nation i WHERE i.ip < ? AND c.code = i.country ORDER BY i.ip DESC LIMIT 0,1", CONNECTION_SYNCH);
|
||||||
PrepareStatement(LOGIN_SEL_AUTOBROADCAST, "SELECT id, weight, text FROM autobroadcast WHERE realmid = ? OR realmid = -1", CONNECTION_SYNCH);
|
PrepareStatement(LOGIN_SEL_AUTOBROADCAST, "SELECT id, weight, text FROM autobroadcast WHERE realmid = ? OR realmid = -1", CONNECTION_SYNCH);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -46,7 +46,7 @@ enum LoginDatabaseStatements
|
|||||||
LOGIN_UPD_VS,
|
LOGIN_UPD_VS,
|
||||||
LOGIN_UPD_LOGONPROOF,
|
LOGIN_UPD_LOGONPROOF,
|
||||||
LOGIN_SEL_LOGONCHALLENGE,
|
LOGIN_SEL_LOGONCHALLENGE,
|
||||||
LOGIN_SEL_LOGON_COUNTRY,
|
LOGIN_SEL_LOGON_COUNTRY,
|
||||||
LOGIN_UPD_FAILEDLOGINS,
|
LOGIN_UPD_FAILEDLOGINS,
|
||||||
LOGIN_SEL_FAILEDLOGINS,
|
LOGIN_SEL_FAILEDLOGINS,
|
||||||
LOGIN_SEL_ACCOUNT_ID_BY_NAME,
|
LOGIN_SEL_ACCOUNT_ID_BY_NAME,
|
||||||
@@ -70,7 +70,7 @@ enum LoginDatabaseStatements
|
|||||||
LOGIN_INS_REALM_CHARACTERS_INIT,
|
LOGIN_INS_REALM_CHARACTERS_INIT,
|
||||||
LOGIN_UPD_EXPANSION,
|
LOGIN_UPD_EXPANSION,
|
||||||
LOGIN_UPD_ACCOUNT_LOCK,
|
LOGIN_UPD_ACCOUNT_LOCK,
|
||||||
LOGIN_UPD_ACCOUNT_LOCK_CONTRY,
|
LOGIN_UPD_ACCOUNT_LOCK_CONTRY,
|
||||||
LOGIN_UPD_USERNAME,
|
LOGIN_UPD_USERNAME,
|
||||||
LOGIN_UPD_PASSWORD,
|
LOGIN_UPD_PASSWORD,
|
||||||
LOGIN_UPD_MUTE_TIME,
|
LOGIN_UPD_MUTE_TIME,
|
||||||
@@ -98,7 +98,7 @@ enum LoginDatabaseStatements
|
|||||||
LOGIN_SEL_ACCOUNT_WHOIS,
|
LOGIN_SEL_ACCOUNT_WHOIS,
|
||||||
LOGIN_SEL_REALMLIST_SECURITY_LEVEL,
|
LOGIN_SEL_REALMLIST_SECURITY_LEVEL,
|
||||||
LOGIN_DEL_ACCOUNT,
|
LOGIN_DEL_ACCOUNT,
|
||||||
LOGIN_SEL_IP2NATION_COUNTRY,
|
LOGIN_SEL_IP2NATION_COUNTRY,
|
||||||
LOGIN_SEL_AUTOBROADCAST,
|
LOGIN_SEL_AUTOBROADCAST,
|
||||||
|
|
||||||
MAX_LOGINDATABASE_STATEMENTS
|
MAX_LOGINDATABASE_STATEMENTS
|
||||||
|
|||||||
@@ -417,32 +417,32 @@ bool AuthSocket::_HandleLogonChallenge()
|
|||||||
else
|
else
|
||||||
;//sLog->outDebug(LOG_FILTER_NETWORKIO, "[AuthChallenge] Account IP matches");
|
;//sLog->outDebug(LOG_FILTER_NETWORKIO, "[AuthChallenge] Account IP matches");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
;//sLog->outDebug(LOG_FILTER_NETWORKIO, "[AuthChallenge] Account '%s' is not locked to ip", _login.c_str());
|
;//sLog->outDebug(LOG_FILTER_NETWORKIO, "[AuthChallenge] Account '%s' is not locked to ip", _login.c_str());
|
||||||
std::string accountCountry = fields[3].GetString();
|
std::string accountCountry = fields[3].GetString();
|
||||||
if (accountCountry.empty() || accountCountry == "00")
|
if (accountCountry.empty() || accountCountry == "00")
|
||||||
;//sLog->outDebug(LOG_FILTER_NETWORKIO, "[AuthChallenge] Account '%s' is not locked to country", _login.c_str());
|
;//sLog->outDebug(LOG_FILTER_NETWORKIO, "[AuthChallenge] Account '%s' is not locked to country", _login.c_str());
|
||||||
else if (!accountCountry.empty())
|
else if (!accountCountry.empty())
|
||||||
{
|
{
|
||||||
uint32 ip = inet_addr(ip_address.c_str());
|
uint32 ip = inet_addr(ip_address.c_str());
|
||||||
EndianConvertReverse(ip);
|
EndianConvertReverse(ip);
|
||||||
|
|
||||||
stmt = LoginDatabase.GetPreparedStatement(LOGIN_SEL_LOGON_COUNTRY);
|
stmt = LoginDatabase.GetPreparedStatement(LOGIN_SEL_LOGON_COUNTRY);
|
||||||
stmt->setUInt32(0, ip);
|
stmt->setUInt32(0, ip);
|
||||||
if (PreparedQueryResult sessionCountryQuery = LoginDatabase.Query(stmt))
|
if (PreparedQueryResult sessionCountryQuery = LoginDatabase.Query(stmt))
|
||||||
{
|
{
|
||||||
std::string loginCountry = (*sessionCountryQuery)[0].GetString();
|
std::string loginCountry = (*sessionCountryQuery)[0].GetString();
|
||||||
;//sLog->outDebug(LOG_FILTER_NETWORKIO, "[AuthChallenge] Account '%s' is locked to country: '%s' Player country is '%s'", _login.c_str(), accountCountry.c_str(), loginCountry.c_str());
|
;//sLog->outDebug(LOG_FILTER_NETWORKIO, "[AuthChallenge] Account '%s' is locked to country: '%s' Player country is '%s'", _login.c_str(), accountCountry.c_str(), loginCountry.c_str());
|
||||||
if (loginCountry != accountCountry)
|
if (loginCountry != accountCountry)
|
||||||
{
|
{
|
||||||
;//sLog->outDebug(LOG_FILTER_NETWORKIO, "[AuthChallenge] Account country differs.");
|
;//sLog->outDebug(LOG_FILTER_NETWORKIO, "[AuthChallenge] Account country differs.");
|
||||||
pkt << uint8(WOW_FAIL_UNLOCKABLE_LOCK);
|
pkt << uint8(WOW_FAIL_UNLOCKABLE_LOCK);
|
||||||
locked = true;
|
locked = true;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
;//sLog->outDebug(LOG_FILTER_NETWORKIO, "[AuthChallenge] Account country matches");
|
;//sLog->outDebug(LOG_FILTER_NETWORKIO, "[AuthChallenge] Account country matches");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
;//sLog->outDebug(LOG_FILTER_NETWORKIO, "[AuthChallenge] IP2NATION Table empty");
|
;//sLog->outDebug(LOG_FILTER_NETWORKIO, "[AuthChallenge] IP2NATION Table empty");
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -248,9 +248,9 @@ public:
|
|||||||
|
|
||||||
if (!param.empty())
|
if (!param.empty())
|
||||||
{
|
{
|
||||||
if (param == "on")
|
if (param == "on")
|
||||||
{
|
{
|
||||||
PreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_SEL_LOGON_COUNTRY);
|
PreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_SEL_LOGON_COUNTRY);
|
||||||
uint32 ip = inet_addr(handler->GetSession()->GetRemoteAddress().c_str());
|
uint32 ip = inet_addr(handler->GetSession()->GetRemoteAddress().c_str());
|
||||||
EndianConvertReverse(ip);
|
EndianConvertReverse(ip);
|
||||||
stmt->setUInt32(0, ip);
|
stmt->setUInt32(0, ip);
|
||||||
@@ -275,8 +275,8 @@ public:
|
|||||||
{
|
{
|
||||||
PreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_UPD_ACCOUNT_LOCK_CONTRY);
|
PreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_UPD_ACCOUNT_LOCK_CONTRY);
|
||||||
stmt->setString(0, "00");
|
stmt->setString(0, "00");
|
||||||
stmt->setUInt32(1, handler->GetSession()->GetAccountId());
|
stmt->setUInt32(1, handler->GetSession()->GetAccountId());
|
||||||
LoginDatabase.Execute(stmt);
|
LoginDatabase.Execute(stmt);
|
||||||
handler->PSendSysMessage(LANG_COMMAND_ACCLOCKUNLOCKED);
|
handler->PSendSysMessage(LANG_COMMAND_ACCLOCKUNLOCKED);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
Reference in New Issue
Block a user