Skip to content

Commit

Permalink
Added connection count and last connection information
Browse files Browse the repository at this point in the history
  • Loading branch information
Timo Smit committed Feb 17, 2017
1 parent 935f71d commit fafc537
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 2 additions & 0 deletions database/new/wolfadmin_sqlite.sql
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ CREATE TABLE IF NOT EXISTS `player` (
`id` INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
`guid` TEXT NOT NULL UNIQUE,
`ip` TEXT NOT NULL,
`lastseen` INTEGER NOT NULL,
`seen` INTEGER NOT NULL,
`level_id` INTEGER NOT NULL,
CONSTRAINT `player_level` FOREIGN KEY (`level_id`) REFERENCES `level` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION
);
Expand Down
4 changes: 2 additions & 2 deletions luamods/wolfadmin/db/sqlite3.lua
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ function sqlite3.addplayer(guid, ip)
cur = assert(con:execute("INSERT INTO `player` (`guid`, `ip`, `level_id`) VALUES ('"..util.escape(guid).."', '"..util.escape(ip).."', 0)"))
end

function sqlite3.updateplayerip(guid, ip)
cur = assert(con:execute("UPDATE `player` SET `ip`='"..util.escape(ip).."' WHERE `guid`='"..util.escape(guid).."'"))
function sqlite3.updateplayer(guid, ip, lastSeen)
cur = assert(con:execute("UPDATE `player` SET `ip`='"..util.escape(ip).."', `lastseen`="..lastSeen..", `seen`=`seen`+1 WHERE `guid`='"..util.escape(guid).."'"))
end

function sqlite3.updateplayerlevel(id, level)
Expand Down

0 comments on commit fafc537

Please sign in to comment.