How best to store names and IP addresses in SQLite?
#1

I'm wanting to store all players IP addresses when they connect to my server.

That way if I suspect someone is ban evading, i can check the IP address or IP range.

So for example, i may want to make a command in IRC which i would do !check playername

That would give me all the ip addresses that the player has used.

Or i may want to write !ipcheck 127.0.0.1

Then get all the players names displayed who have connected with the specified IP or IP range.

I'm just not really sure on the best way to store the data.

Woulds it be to create a new table per name? or per IP?

Or create a colum of names, then colums for every new IP?
Reply
#2

The way I did this was to store name/IP pairs. I'm not if there's a better way but it seems to fit sqlite quite well. It also means you can store stuff like the last time they were online, and the total time they've been online.

Here's the functions I used http://pastebin.com/f52d88c15

Alias_Add should be used when they connect
Alias_Update when they leave (you'll need to store their IP since GetPlayerIp returns 255.255.255.255 in OnPlayerDisconnect)

The alias is the names used by the same IP, alias2 is the names on the same range, and alias3 is the names use by the player's previous IPs
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)