CheckGMIPs to QueryDatabase

This commit is contained in:
Arthur Ice 2014-07-03 15:26:39 -07:00 committed by Arthur Ice
parent 7f135d6e55
commit cbf49b303b

View File

@ -223,24 +223,17 @@ bool Database::AddBannedIP(char* bannedIP, const char* notes)
}
bool Database::CheckGMIPs(const char* ip_address, uint32 account_id) {
char errbuf[MYSQL_ERRMSG_SIZE];
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);
char *query = nullptr;
} else {
safe_delete_array(query);
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);
if (!results.Success())
return false;
}
if (results.RowCount() == 1)
return true;
return false;
}