fixes connection logging to DB not working

This commit is contained in:
Kyep
2019-12-16 15:55:04 -08:00
parent fe53a5acf9
commit a4e6dba738
4 changed files with 39 additions and 3 deletions
+14
View File
@@ -579,4 +579,18 @@ CREATE TABLE `playtime_history` (
`time_living` SMALLINT NOT NULL,
`time_ghost` SMALLINT NOT NULL,
PRIMARY KEY (`ckey`, `date`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Table structure for table `connection_log`
--
DROP TABLE IF EXISTS `connection_log`;
CREATE TABLE `connection_log` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`datetime` datetime NOT NULL,
`ckey` varchar(32) NOT NULL,
`ip` varchar(32) NOT NULL,
`computerid` varchar(32) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
+13
View File
@@ -577,4 +577,17 @@ CREATE TABLE `SS13_playtime_history` (
`time_living` SMALLINT NOT NULL,
`time_ghost` SMALLINT NOT NULL,
PRIMARY KEY (`ckey`, `date`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Table structure for table `SS13_connection_log`
--
DROP TABLE IF EXISTS `SS13_connection_log`;
CREATE TABLE `SS13_connection_log` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`datetime` datetime NOT NULL,
`ckey` varchar(32) NOT NULL,
`ip` varchar(32) NOT NULL,
`computerid` varchar(32) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
+10
View File
@@ -9,3 +9,13 @@ CREATE TABLE `playtime_history` (
PRIMARY KEY (`ckey`, `date`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
# Add the 'connection_log' table, which is used to log all connections to the server
DROP TABLE IF EXISTS `connection_log`;
CREATE TABLE `connection_log` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`datetime` datetime NOT NULL,
`ckey` varchar(32) NOT NULL,
`ip` varchar(32) NOT NULL,
`computerid` varchar(32) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
+2 -3
View File
@@ -560,9 +560,8 @@
log_game("SQL ERROR during log_client_to_db (insert). Error : \[[err]\]\n")
message_admins("SQL ERROR during log_client_to_db (insert). Error : \[[err]\]\n")
//Logging player access
var/serverip = "[world.internet_address]:[world.port]"
var/DBQuery/query_accesslog = dbcon.NewQuery("INSERT INTO `[format_table_name("connection_log")]`(`id`,`datetime`,`serverip`,`ckey`,`ip`,`computerid`) VALUES(null,Now(),'[serverip]','[ckey]','[sql_ip]','[sql_computerid]');")
// Log player connections to DB
var/DBQuery/query_accesslog = dbcon.NewQuery("INSERT INTO `[format_table_name("connection_log")]`(`datetime`,`ckey`,`ip`,`computerid`) VALUES(Now(),'[ckey]','[sql_ip]','[sql_computerid]');")
query_accesslog.Execute()
/client/proc/check_ip_intel()