2023-02-03 11:38:47 +01:00
|
|
|
CREATE TABLE `ban_detector` (
|
2023-02-02 00:19:27 +01:00
|
|
|
`fingerprint` varchar(512) NOT NULL,
|
|
|
|
`ip` varchar(64) NOT NULL,
|
2023-02-07 20:45:15 +01:00
|
|
|
`created_on` datetime DEFAULT CURRENT_TIMESTAMP,
|
|
|
|
`ID` int AUTO_INCREMENT,
|
|
|
|
PRIMARY KEY (`fingerprint`,`ip`),
|
|
|
|
KEY `ID` (`ID`)
|
|
|
|
)
|
2023-02-03 11:38:47 +01:00
|
|
|
|
|
|
|
|
2023-02-07 20:45:15 +01:00
|
|
|
CREATE TABLE `ban_detector_steamids` (
|
|
|
|
`steamid` varchar(64) DEFAULT NULL,
|
|
|
|
`name` varchar(128) DEFAULT NULL,
|
|
|
|
`ID` int NOT NULL,
|
|
|
|
FOREIGN KEY (`ID`) REFERENCES ban_detector(ID)
|
|
|
|
ON DELETE CASCADE
|
|
|
|
)
|
|
|
|
|
2023-02-03 11:38:47 +01:00
|
|
|
--usefull read query
|
|
|
|
select bd2.* from ban_detector bd2
|
|
|
|
inner join
|
|
|
|
(
|
|
|
|
SELECT fingerprint,
|
|
|
|
count(*) AS c
|
|
|
|
FROM ban_detector bd
|
|
|
|
GROUP BY fingerprint
|
|
|
|
HAVING c > 1
|
|
|
|
ORDER BY c DESC
|
|
|
|
) as t
|
|
|
|
on bd2.fingerprint = t.fingerprint
|
|
|
|
|
|
|
|
|
|
|
|
|