[FilterScript] [MySQL R41-4] IP Logger (dialogs)
#13

Quote:
Originally Posted by TheToretto
View Post
Hey, thanks a lot for the tips, I really appreciate it, I've done everything you mentioned, (Commit) except the datetime, do you have an example or something? And I want to keep the same actual form displayed in the dialogs, if possible.
Yes, it is possible: https://dev.mysql.com/doc/refman/8.0...on_date-format
pawn Code:
SELECT IP,
       DATE_FORMAT(Connected, '%%Y %%M %%e - %%T') AS Connected
  FROM iplogger
 WHERE Name = '%e'
Thank you for taking into consideration my suggestions. Re-consider about the use of threaded SELECT queries.

When your table does not have a primary key and searches by name, it filters about 10 percent -- it scans the whole table for looking any matches. A name cannot be unique as a player can connect more than once but a pair can be. A player joins a specific time, this pair is unique and we can also take advantage of it.

pawn Code:
CREATE TABLE `iplogger` (
  `Name` varchar(24) NOT NULL,
  `IP` varchar(15) NOT NULL,
  `Connected` datetime NOT NULL,
  `Disconnected` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
  PRIMARY KEY (`Name`,`Connected`)
)
Now it filters 100 percent.

Store unix timestamp on connect for a player and use FROM_UNIXTIME when a player disconnects.
pawn Code:
INSERT INTO iplogger (Name, IP, Connected)
VALUES ('%s', '%s', FROM_UNIXTIME(%d))
There is one last suggestion: IPv4 can be converted to integer and take less space. If you are interested:
https://dev.mysql.com/doc/refman/8.0...tion_inet-aton
https://dev.mysql.com/doc/refman/8.0...tion_inet-ntoa

Store IP as unsigned int and the use is very simply INET_ATON('127.0.0.1') and INET_NTOA(IP)
Reply


Messages In This Thread
[MySQL R41-4] IP Logger (dialogs) - by TheToretto - 02.11.2018, 13:07
Re: [MySQL R41-4] IP Logger (dialogs) - by Franovitch - 02.11.2018, 13:24
Re: [MySQL R41-4] IP Logger (dialogs) - by Zeus666 - 02.11.2018, 13:57
Re: [MySQL R41-4] IP Logger (dialogs) - by Heress - 02.11.2018, 14:18
Re: [MySQL R41-4] IP Logger (dialogs) - by Calisthenics - 02.11.2018, 14:26
Re: [MySQL R41-4] IP Logger (dialogs) - by TheToretto - 02.11.2018, 15:31
Re: [MySQL R41-4] IP Logger (dialogs) - by CaptainBoi - 02.11.2018, 16:59
Re: [MySQL R41-4] IP Logger (dialogs) - by zakariacaspeer - 02.11.2018, 17:51
Re: [MySQL R41-4] IP Logger (dialogs) - by KinderClans - 02.11.2018, 20:22
Re: [MySQL R41-4] IP Logger (dialogs) - by TheToretto - 02.11.2018, 20:48
Re: [MySQL R41-4] IP Logger (dialogs) - by solstice_ - 02.11.2018, 21:05
Re: [MySQL R41-4] IP Logger (dialogs) - by TheToretto - 02.11.2018, 21:08
Re: [MySQL R41-4] IP Logger (dialogs) - by Calisthenics - 03.11.2018, 10:01
Re: [MySQL R41-4] IP Logger (dialogs) - by Mellnik - 03.11.2018, 13:11
Re: [MySQL R41-4] IP Logger (dialogs) - by GameOvr - 03.11.2018, 14:13
Re: [MySQL R41-4] IP Logger (dialogs) - by TheToretto - 03.11.2018, 16:02
Re: [MySQL R41-4] IP Logger (dialogs) - by GameOvr - 03.11.2018, 16:42
Re: [MySQL R41-4] IP Logger (dialogs) - by Calisthenics - 04.11.2018, 12:28
Re: [MySQL R41-4] IP Logger (dialogs) - by TheToretto - 04.11.2018, 13:13
Re: [MySQL R41-4] IP Logger (dialogs) - by Jefff - 07.11.2018, 01:14
Re: [MySQL R41-4] IP Logger (dialogs) - by cSharp - 07.11.2018, 04:49
Re: [MySQL R41-4] IP Logger (dialogs) - by Calisthenics - 07.11.2018, 07:49
Re: [MySQL R41-4] IP Logger (dialogs) - by BlackyX - 02.01.2019, 10:52
Re: [MySQL R41-4] IP Logger (dialogs) - by TheWhiteJew - 02.01.2019, 15:51

Forum Jump:


Users browsing this thread: 1 Guest(s)