diff options
| author | Gooyeth <566327+Gooyeth@users.noreply.github.com> | 2018-06-22 17:32:39 -0600 |
|---|---|---|
| committer | Aokromes <Aokromes@users.noreply.github.com> | 2018-06-23 01:32:39 +0200 |
| commit | 2fe4ab94c52ad2fa90189ecd9c053da49f06561e (patch) | |
| tree | d505bd2176de8a659401c1b87694ca20c96bedb3 /src/server/game/Server | |
| parent | 0dcc318e377138dcbc116b5703d7dc1bffc0cc0f (diff) | |
Common: Replace ip2nation by ip2location. (#21957)
Replace ip2nation by ip2location.
Download: https://lite.ip2location.com/database/ip-country
Diffstat (limited to 'src/server/game/Server')
| -rw-r--r-- | src/server/game/Server/WorldSocket.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/server/game/Server/WorldSocket.cpp b/src/server/game/Server/WorldSocket.cpp index 5cb8e056b01..7048879b9d4 100644 --- a/src/server/game/Server/WorldSocket.cpp +++ b/src/server/game/Server/WorldSocket.cpp @@ -20,6 +20,7 @@ #include "BigNumber.h" #include "DatabaseEnv.h" #include "GameTime.h" +#include "IPLocation.h" #include "Opcodes.h" #include "PacketLog.h" #include "Random.h" @@ -55,7 +56,6 @@ void WorldSocket::Start() std::string ip_address = GetRemoteIpAddress().to_string(); PreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_SEL_IP_INFO); stmt->setString(0, ip_address); - stmt->setUInt32(1, inet_addr(ip_address.c_str())); _queryProcessor.AddQuery(LoginDatabase.AsyncQuery(stmt).WithPreparedCallback(std::bind(&WorldSocket::CheckIpCallback, this, std::placeholders::_1))); } @@ -71,9 +71,6 @@ void WorldSocket::CheckIpCallback(PreparedQueryResult result) if (fields[0].GetUInt64() != 0) banned = true; - if (!fields[1].GetString().empty()) - _ipCountry = fields[1].GetString(); - } while (result->NextRow()); if (banned) @@ -523,6 +520,9 @@ void WorldSocket::HandleAuthSessionCallback(std::shared_ptr<AuthSession> authSes return; } + if (IpLocationRecord* location = sIPLocation->GetData(address)) + _ipCountry = location->country_code; + ///- Re-check ip locking (same check as in auth). if (account.IsLockedToIP) { |
