SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Filterscripts

Reply
 
Thread Tools Display Modes
Old 02/11/2018, 02:07 PM   #1
TheToretto
Huge Clucker
 
TheToretto's Avatar
 
Join Date: Jul 2015
Posts: 269
Reputation: 22
Default [MySQL R41-4] IP Logger (dialogs)

IP Logger
(MySQL R41-4)

Introduction:

What it does is basically, every time someone connects to the server, when he disconnects, even if he doesn't register, it saves: The username, the IP, the date and exact time he connected, and disconnected. So four fields. How can this be useful? Well, an example is: You can detect multi-accounts. (manually ofc, I can release an automated one if requested.)

Screenshots:









Dependencies :

Source code:
__________________






Toretto#9902

Rest in peace grandpa, 03 November 2018
TheToretto is offline   Reply With Quote
Old 02/11/2018, 02:24 PM   #2
Franovitch
Little Clucker
 
Join Date: Sep 2018
Posts: 1
Reputation: 0
Default Re: [MySQL R41-4] IP Logger (dialogs)

brilliant !
Franovitch is offline   Reply With Quote
Old 02/11/2018, 02:57 PM   #3
Zeus666
Gangsta
 
Join Date: Mar 2015
Posts: 680
Reputation: 50
Default Re: [MySQL R41-4] IP Logger (dialogs)

Nice
Zeus666 is offline   Reply With Quote
Old 02/11/2018, 03:18 PM   #4
Heress
Big Clucker
 
Heress's Avatar
 
Join Date: Mar 2018
Location: Lithuania
Posts: 137
Reputation: 2
Default Re: [MySQL R41-4] IP Logger (dialogs)

It's AMAZING!!
__________________
========================================
If I helped you - +rep
Sorry for my bad English
Heress is offline   Reply With Quote
Old 02/11/2018, 03:26 PM   #5
Calisthenics
Huge Clucker
 
Join Date: May 2018
Posts: 422
Reputation: 69
Default Re: [MySQL R41-4] IP Logger (dialogs)

Provide a .sql file about the table structure please.

Few tips to consider:
  • Save dates as TIMESTAMP OR DATETIME datatype and not as string. There is mysql function to format a readable form and an integrated system can even allow you retrieving total online time and many more benefits.
  • Avoid non-threaded queries as it can lead to memory leaks (you forgot to delete the cache instance).
  • Do not copy strings directly as this:
    pawn Code:
    g_ConnectionDate[playerid] = ReturnDate();
    g_pIP[playerid] = ReturnIP(playerid);

    g_DisconnectionDate[playerid] = ReturnDate();
    There is `strcpy` (macro of `strcat`) or `memcpy` function. Avoid `format` function.
  • Select columns you want to retrieve and not everything. `Name` or `Disconnected` columns are never retrieved.
  • Set appropriate keys to table structure. Searching by a string is slower than an integer. Searching by a non-indexed string is even slower.
Calisthenics is offline   Reply With Quote
Old 02/11/2018, 04:31 PM   #6
TheToretto
Huge Clucker
 
TheToretto's Avatar
 
Join Date: Jul 2015
Posts: 269
Reputation: 22
Default Re: [MySQL R41-4] IP Logger (dialogs)

Quote:
Originally Posted by Calisthenics View Post
Provide a .sql file about the table structure please.

Few tips to consider:
  • Save dates as TIMESTAMP OR DATETIME datatype and not as string. There is mysql function to format a readable form and an integrated system can even allow you retrieving total online time and many more benefits.
  • Avoid non-threaded queries as it can lead to memory leaks (you forgot to delete the cache instance).
  • Do not copy strings directly as this:
    pawn Code:
    g_ConnectionDate[playerid] = ReturnDate();
    g_pIP[playerid] = ReturnIP(playerid);

    g_DisconnectionDate[playerid] = ReturnDate();
    There is `strcpy` (macro of `strcat`) or `memcpy` function. Avoid `format` function.
  • Select columns you want to retrieve and not everything. `Name` or `Disconnected` columns are never retrieved.
  • Set appropriate keys to table structure. Searching by a string is slower than an integer. Searching by a non-indexed string is even slower.
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.
__________________






Toretto#9902

Rest in peace grandpa, 03 November 2018
TheToretto is offline   Reply With Quote
Old 02/11/2018, 05:59 PM   #7
CaptainBoi
Huge Clucker
 
CaptainBoi's Avatar
 
Join Date: May 2018
Location: India
Posts: 260
Reputation: 25
Default Re: [MySQL R41-4] IP Logger (dialogs)

Well really good job!
__________________
Code:
Releases
[FilterScript] Dynamic MySQL GPS System
[Tutorial] How to make TDM Team Selection.
[Include] moneybar.inc || Coloured Moneybar || Released
[Tutorial] PAWN Compiler In Notepad++
[FilterScript] Perks System (v: [On Update]) [DINI, ZCMD]
[FilterScript] Realistic Transmission Speedometer
CaptainBoi is offline   Reply With Quote
Old 02/11/2018, 06:51 PM   #8
zakariacaspeer
Little Clucker
 
zakariacaspeer's Avatar
 
Join Date: Oct 2018
Location: Morrocain
Posts: 15
Reputation: 0
Default Re: [MySQL R41-4] IP Logger (dialogs)

wow nice bro
__________________
zakariacaspeer is offline   Reply With Quote
Old 02/11/2018, 09:22 PM   #9
KinderClans
Banned
 
Join Date: May 2018
Location: Italy
Posts: 749
Reputation: 43
Default Re: [MySQL R41-4] IP Logger (dialogs)

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.
pawn Code:
INSERT INTO yourtable (time_column) VALUES (NOW())

To show it:

pawn Code:
new date[36], string[40];
cache_get_value_name(i,"time_column", date, 36);
format(string, sizeof(string), "Date: %s", date);
KinderClans is offline   Reply With Quote
Old 02/11/2018, 09:48 PM   #10
TheToretto
Huge Clucker
 
TheToretto's Avatar
 
Join Date: Jul 2015
Posts: 269
Reputation: 22
Default Re: [MySQL R41-4] IP Logger (dialogs)

Quote:
Originally Posted by KinderClans View Post
pawn Code:
INSERT INTO yourtable (time_column) VALUES (NOW())

To show it:

pawn Code:
new date[36], string[40];
cache_get_value_name(i,"time_column", date, 36);
format(string, sizeof(string), "Date: %s", date);
Thanks, but what if I want to just store the time? Because, I send only one query, to save both the connection date & disconnection. I don't want to use multiple queries.
__________________






Toretto#9902

Rest in peace grandpa, 03 November 2018
TheToretto is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
[FilterScript] [SQLite] Advanced IP Logger (dialogs + save up to 50 ips per user with next buttons) OverflowJ Filterscripts 14 28/10/2018 08:16 PM
[FilterScript] HTML Command logger Floriian Filterscripts 3 29/01/2016 03:50 PM
key logger? Anak Everything and Nothing 22 27/05/2013 04:53 AM
[FilterScript] [FS] RCON Logger _[HuN]_Epsilon_ Filterscripts 4 03/02/2010 04:29 PM
ip logger Commander_Shaw Help Archive 5 14/03/2009 09:17 AM


All times are GMT. The time now is 05:14 PM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.