added like queries for subblocks of ip's
This commit is contained in:
parent
d532a3a5c1
commit
595bb74543
@ -138,7 +138,11 @@ public void SQL_insert(Database db, DBResultSet results, const char[] error, any
|
||||
if ((client = GetClientFromSerial(data)) == 0)
|
||||
return;
|
||||
char sql_statement[512];
|
||||
Format(sql_statement, sizeof(sql_statement), "update connect_restriction cr1 inner join (select * from connect_restriction cr3 where cr3.asn = '%s' and cr3.provider = '%s' and cr3.country = '%s' and cr3.cooldown > CURDATE() order by cr3.inserted_on desc limit 1) as cr2 on cr1.asn = cr2.asn and cr1.provider = cr2.provider and cr1.country = cr2.country set cr1.cooldown = cr2.cooldown", g_asn[client], g_provider[client], g_country[client]);
|
||||
char sIP[64];
|
||||
char ip_subblock[8][8];
|
||||
GetClientIP(client, sIP, sizeof(sIP));
|
||||
ExplodeString(sIP, ".", ip_subblock, sizeof(ip_subblock), sizeof(ip_subblock[]));
|
||||
Format(sql_statement, sizeof(sql_statement), "update connect_restriction cr1 inner join (select * from connect_restriction cr3 where cr3.asn = '%s' and cr3.provider = '%s' and cr3.country = '%s' and cr3.ipv4 like '%s.%s%s' and cr3.cooldown > CURDATE() order by cr3.inserted_on desc limit 1) as cr2 on cr1.asn = cr2.asn and cr1.provider = cr2.provider and cr1.country = cr2.country set cr1.cooldown = cr2.cooldown", g_asn[client], g_provider[client], g_country[client], ip_subblock[0], ip_subblock[1], "%");
|
||||
delete results;
|
||||
g_hDatabase.Query(SQL_update_restriction, sql_statement, GetClientSerial(client), DBPrio_High);
|
||||
}
|
||||
@ -154,8 +158,12 @@ public void SQL_update_restriction(Database db, DBResultSet results, const char[
|
||||
if ((client = GetClientFromSerial(data)) == 0)
|
||||
return;
|
||||
delete results;
|
||||
char sIP[64];
|
||||
char ip_subblock[8][8];
|
||||
GetClientIP(client, sIP, sizeof(sIP));
|
||||
ExplodeString(sIP, ".", ip_subblock, sizeof(ip_subblock), sizeof(ip_subblock[]));
|
||||
char sql_statement[512];
|
||||
Format(sql_statement, sizeof(sql_statement), "select * from connect_restriction where asn = '%s' and provider = '%s' and country = '%s' and cooldown > CURDATE() order by inserted_on desc limit 1", g_asn[client], g_provider[client], g_country[client]);
|
||||
Format(sql_statement, sizeof(sql_statement), "select * from connect_restriction where asn = '%s' and provider = '%s' and country = '%s' and ipv4 like '%s.%s%s' and cooldown > CURDATE() order by inserted_on desc limit 1", g_asn[client], g_provider[client], g_country[client], ip_subblock[0], ip_subblock[1], "%");
|
||||
g_hDatabase.Query(sql_select_cooldown, sql_statement, GetClientSerial(client), DBPrio_High);
|
||||
}
|
||||
|
||||
@ -212,7 +220,7 @@ public void sql_select_sb_bans(Database db, DBResultSet results, const char[] er
|
||||
GetClientIP(client, s_client_ip, sizeof(s_client_ip));
|
||||
char sql_statement[2856];
|
||||
|
||||
//in case that very last client exceeds 2700
|
||||
//in case that very last client exceeds 2700 on the last query
|
||||
bool after_result = true;
|
||||
Format(sql_statement, sizeof(sql_statement), "INSERT IGNORE INTO `sb_bans_shortened` (`steam_id`,`ipv4`) VALUES ");
|
||||
while (results.RowCount && results.FetchRow())
|
||||
@ -237,7 +245,9 @@ public void sql_select_sb_bans(Database db, DBResultSet results, const char[] er
|
||||
g_hDatabase.Query(sql_insert_dummy, sql_statement, _, DBPrio_High);
|
||||
}
|
||||
delete results;
|
||||
Format(sql_statement, sizeof(sql_statement), "select cr1.* from connect_restriction cr1 inner join connect_restriction cr2 on cr1.asn = cr2.asn inner join sb_bans_shortened cr3 on cr1.steam_id = cr3.steam_id and cr1.ipv4 = cr3.ipv4 and cr1.provider = cr2.provider and cr1.country = cr2.country and cr2.ipv4 = '%s' limit 1", s_client_ip);
|
||||
char ip_subblock[8][8];
|
||||
ExplodeString(s_client_ip, ".", ip_subblock, sizeof(ip_subblock), sizeof(ip_subblock[]));
|
||||
Format(sql_statement, sizeof(sql_statement), "select cr1.* from connect_restriction cr1 inner join connect_restriction cr2 on cr1.asn = cr2.asn inner join sb_bans_shortened cr3 on cr1.steam_id = cr3.steam_id and cr1.ipv4 = cr3.ipv4 and cr1.provider = cr2.provider and cr1.country = cr2.country and cr2.ipv4 = '%s' and cr1.ipv4 like '%s.%s%s' limit 1", s_client_ip, ip_subblock[0], ip_subblock[1], "%");
|
||||
g_hDatabase.Query(sql_select_banned, sql_statement, GetClientSerial(client), DBPrio_High);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user