Help with combining player data from different files
#1

Hello, my current admin script uses 2 files to store players' nicknames and ip addresses: one of the files is aka.txt and the other is ips.txt, with these 2 files doing opposite things: while aka.txt stores all nicks that have connected from each ip address, ips.txt conversely stores all ip's each nick has connected from. For example, imagine that I join my server from the ip address 192.87.36.44 (I typed these numbers randomly) and with Gryphus_One as my nick. My aka.txt file will look like this:
Код:
192.87.36.44=Gryphus_One
Whereas my ips.txt file will look like this:
Код:
Gryphus_One=192.87.36.44
Now, imagine that while keeping my same ip, I then change my nick to domiye. My aka.txt file will look like this:
Код:
192.87.36.44=Gryphus_One,domiye
Whereas my ips.txt file will have a new row and look like this:
Код:
Gryphus_One=192.87.36.44
domiye=192.87.36.44
Now, imagine that my ip changes to 192.87.58.12 (once again, I typed these numbers randomly), but I keep domiye as my nick. My aka.txt file will have a new row and look like this:
Код:
192.87.36.44=Gryphus_One,domiye
192.87.58.12=domiye
Whereas my ips.txt file will look like this:
Код:
Gryphus_One=192.87.36.44
domiye=192.87.36.44,192.87.58.12
And now, I change my nick again and join my server as Bubba, but I keep my previous ip. My aka.txt file will look like this:
Код:
192.87.36.44=Gryphus_One,domiye
192.87.58.12=domiye,Bubba
Whereas my ips.txt file will again have a new row and look like this:
Код:
Gryphus_One=192.87.36.44
domiye=192.87.36.44,192.87.58.12
Bubba=192.87.58.12
So, what do I want? very simple: I want a piece of script that creates a new file and combines data from these 2 other files, showing in 2 rows all nicks and ip's I have had. Something like this:
Код:
nicks=Gryphus_One,domiye,Bubba
addresses=192.87.36.44,192.87.58.12
With something like this, not only would I have it much easier to track my players and tell whether or not different nicks and ip's belong to the same player, but also when it comes to banning and unbanning someone, I should be able to ban/unban all his nicks and ip's at the same time, instead of having to figure them out and ban/unban each one of them individually.
Reply
#2

This would require some rather tedious code. It would be much easier to use MySQL/SQLite as you could send a simple query and get everything you want.

Also, as you are simply asking for the system and not looking for help, this should not be posted here.
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)