Page 1 of 1

Registering logins to the nuBuilder database

Posted: Sat Feb 20, 2021 8:39 pm
by Janusz
Hi, recently there was few topics how to get the client computer IPs and how to register logins.
As an example you can have a look on my implementation for the registration of the client IP's both for the successful and unsuccessful logins.
https://nubuilderforte.blogspot.com/

Re: Registering logins to the nuBuilder database

Posted: Sun Feb 21, 2021 8:53 am
by miasoft
Thx, Janusz! Very useful information. Still would get the StorageProcedure's source code , so as not to reinvent the wheel. :)

Re: Registering logins to the nuBuilder database

Posted: Tue Feb 23, 2021 3:32 pm
by icoso
Janusz wrote:Hi, recently there was few topics how to get the client computer IPs and how to register logins.
As an example you can have a look on my implementation for the registration of the client IP's both for the successful and unsuccessful logins.
https://nubuilderforte.blogspot.com/
Where can we get the programming code for this IP Address Logger?

Re: Registering logins to the nuBuilder database

Posted: Tue Feb 23, 2021 6:07 pm
by Janusz
Hi,
I have just added the code to the Blog.
https://nubuilderforte.blogspot.com/

Re: Registering logins to the nuBuilder database

Posted: Thu Feb 25, 2021 1:20 am
by apmuthu
Your code in the blog is attached here.
record_logins_Code.txt
Consider the hypothetical situation where a record exists for zx_IPs_id=ip but with
ips_OK_qty+ips_Bad_qty = 0
OR
(ips_OK_qty = 0 AND ips_Bad_qty = 0)
the INSERT parts would fail.

Quick Fix:
INSERT IGNORE....

Better Fix:
UPDATE statement on DUPLICATE Primary Key


The English Auto-generated (and corrected) transcript (remove the .txt extension) of the video is attached.
nuBuilder - record logins to DB.srt

Re: Registering logins to the nuBuilder database

Posted: Thu Feb 25, 2021 5:13 am
by Janusz
apmuthu wrote:
Consider the hypothetical situation where a record exists for zx_IPs_id=ip but with
ips_OK_qty+ips_Bad_qty = 0
OR
(ips_OK_qty = 0 AND ips_Bad_qty = 0)
the INSERT parts would fail.
Such situation is not possible.
Always initial insert is setting the ips_OK/Bad_qty value to 1:

Code: Select all

...
INSERT INTO zx_IPs (zx_IPs_id,ips_OK_qty) VALUES (ip,1);
....
INSERT INTO zx_IPs (zx_IPs_id,ips_Bad_qty,ips_last_bad,ips_Bad_username) VALUES (ip,1,NOW(),user);