bool ChatHandler::HandleLookupPlayerIpCommand(const char* args) { std::string ip; int32 limit; char* limit_str; Player *chr = getSelectedPlayer(); if (!*args) { // NULL only if used from console if (!chr || chr == GetSession()->GetPlayer()) return false; ip = chr->GetSession()->GetRemoteAddress(); limit = -1; } else { ip = strtok ((char*)args, " "); limit_str = strtok (NULL, " "); limit = limit_str ? atoi (limit_str) : -1; } PreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_SEL_ACCOUNT_BY_IP); stmt->setString(0, ip); PreparedQueryResult result = LoginDatabase.Query(stmt); return LookupPlayerSearchCommand(result, limit); }
bool ChatHandler::HandleLookupPlayerIpCommand(const char* args) { std::string ip; int32 limit; char* limit_str; Player *chr = getSelectedPlayer(); if (!*args) { // NULL only if used from console if (!chr || chr == GetSession()->GetPlayer()) return false; ip = chr->GetSession()->GetRemoteAddress(); limit = -1; } else { ip = strtok ((char*)args, " "); limit_str = strtok (NULL, " "); limit = limit_str ? atoi (limit_str) : -1; } LoginDatabase.EscapeString(ip); QueryResult result = LoginDatabase.PQuery("SELECT id, username FROM account WHERE last_ip = '%s'", ip.c_str()); return LookupPlayerSearchCommand(result, limit); }
bool ChatHandler::HandleLookupPlayerEmailCommand(const char* args) { if (!*args) return false; std::string email = strtok ((char*)args, " "); char* limit_str = strtok (NULL, " "); int32 limit = limit_str ? atoi (limit_str) : -1; PreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_SEL_ACCOUNT_LIST_BY_EMAIL); stmt->setString(0, email); PreparedQueryResult result = LoginDatabase.Query(stmt); return LookupPlayerSearchCommand(result, limit); }
bool ChatHandler::HandleLookupPlayerEmailCommand(const char* args) { if (!*args) return false; std::string email = strtok ((char*)args, " "); char* limit_str = strtok (NULL, " "); int32 limit = limit_str ? atoi (limit_str) : -1; LoginDatabase.EscapeString (email); QueryResult result = LoginDatabase.PQuery ("SELECT id, username FROM account WHERE email = '%s'", email.c_str ()); return LookupPlayerSearchCommand (result, limit); }
bool ChatHandler::HandleLookupPlayerAccountCommand(const char* args) { if (!*args) return false; std::string account = strtok ((char*)args, " "); char* limit_str = strtok (NULL, " "); int32 limit = limit_str ? atoi (limit_str) : -1; if (!AccountMgr::normalizeString (account)) return false; PreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_SEL_ACCOUNT_LIST_BY_NAME); stmt->setString(0, account); PreparedQueryResult result = LoginDatabase.Query(stmt); return LookupPlayerSearchCommand (result, limit); }
bool ChatHandler::HandleLookupPlayerAccountCommand(const char* args) { if (!*args) return false; std::string account = strtok ((char*)args, " "); char* limit_str = strtok (NULL, " "); int32 limit = limit_str ? atoi (limit_str) : -1; if (!AccountMgr::normalizeString (account)) return false; LoginDatabase.EscapeString (account); QueryResult result = LoginDatabase.PQuery ("SELECT id, username FROM account WHERE username = '******'", account.c_str ()); return LookupPlayerSearchCommand (result, limit); }