mirror of
https://github.com/EQEmu/Server.git
synced 2025-12-17 18:41:29 +00:00
CheckGMIPs to QueryDatabase
This commit is contained in:
parent
7f135d6e55
commit
cbf49b303b
@ -223,24 +223,17 @@ bool Database::AddBannedIP(char* bannedIP, const char* notes)
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool Database::CheckGMIPs(const char* ip_address, uint32 account_id) {
|
bool Database::CheckGMIPs(const char* ip_address, uint32 account_id) {
|
||||||
char errbuf[MYSQL_ERRMSG_SIZE];
|
char *query = nullptr;
|
||||||
char *query = 0;
|
|
||||||
MYSQL_RES *result;
|
|
||||||
if (RunQuery(query, MakeAnyLenString(&query, "SELECT * FROM `gm_ips` WHERE `ip_address` = '%s' AND `account_id` = %i", ip_address, account_id), errbuf, &result)) {
|
|
||||||
safe_delete_array(query);
|
|
||||||
if (mysql_num_rows(result) == 1) {
|
|
||||||
mysql_free_result(result);
|
|
||||||
return true;
|
|
||||||
} else {
|
|
||||||
mysql_free_result(result);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
mysql_free_result(result);
|
|
||||||
|
|
||||||
} else {
|
auto results = QueryDatabase(query, MakeAnyLenString(&query, "SELECT * FROM `gm_ips` WHERE `ip_address` = '%s' AND `account_id` = %i", ip_address, account_id));
|
||||||
safe_delete_array(query);
|
|
||||||
|
safe_delete_array(query);
|
||||||
|
|
||||||
|
if (!results.Success())
|
||||||
return false;
|
return false;
|
||||||
}
|
|
||||||
|
if (results.RowCount() == 1)
|
||||||
|
return true;
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user