vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 4.x Add-ons (https://vborg.vbsupport.ru/forumdisplay.php?f=245)
-   -   Administrative and Maintenance Tools - Login log - Log successful login attempts (https://vborg.vbsupport.ru/showthread.php?t=311735)

Dave 05-27-2014 10:00 PM

Login log - Log successful login attempts
 
1 Attachment(s)
Hi,

This plugin will allow you to log all successful login attempts of all users.
This can be useful to see if users share their account or if the account of someone got hijacked. Usernames and IP addresses can be clicked.

It will log the following
- Userid
- Username
- IP
- ISP (Internet Service Provider)
- Country
- HTTP user agent

Settings:
- Enable/disable the product.
- Exclude usergroups from being logged.
- Purge the logs.

Picture
https://vborg.vbsupport.ru/attachmen...1&d=1401289428

Installation
1. Download the .zip file specified.
2. Upload the contents of the upload folder to the root of your forum.
3. Import the product with the .xml file in the import folder.

Note
The script will log using the current time on the server, in case there's a difference between the server time and your local computer time, you can change the offset in the loginlog.php script on line 12.

Also keep in mind that the country and/or ISP resolving might not be 100% accurate and that it might show no value in the logs.

Credits
Telize.com its API is being used to get the ISP and country off the IP address.

Let me know if it works well. :)


Changelog
11 June 2014 V4: Added the table_prefix global to the login hook.
5 June 2014 V3: Fixed searching only showing the last 25 entries. Pagination will now work as intended.
30 May 2014 V2: Changed hook location, added enable/disable setting and a setting to exclude usergroups.
28 May 2014 V1: Fixed a little mistake with the filter.

tbworld 05-28-2014 06:07 PM

Thanks for sharing. :)

MentaL 05-28-2014 10:04 PM

Looks good but you may want to fix the double user sessions being logged. Mobile/Tapatalk seem to cause a lot of trouble and tripple actions.

Dave 05-29-2014 08:12 AM

Quote:

Originally Posted by MentaL (Post 2499847)
Looks good but you may want to fix the double user sessions being logged. Mobile/Tapatalk seem to cause a lot of trouble and tripple actions.

Hmm weird, I looked at the PHP code of Tapatalk but I'm unsure what's causing it.
I use the login_process hook, which is defined as "creates new session once $vbulletin->userinfo has been set to the newly logged in user".

Could you change the hook at the plugin manager to login_verify_success instead of login_process, see if that works? I can't test that myself as I don't have Tapatalk installed.

EvoDarrenshan 05-29-2014 11:59 PM

Can you target this for specific usergroups?

Dave 05-30-2014 08:33 AM

Quote:

Originally Posted by EvoDarrenshan (Post 2500074)
Can you target this for specific usergroups?

Will add this feature, keep an eye on this thread.

Dave 05-30-2014 12:13 PM

I updated the plugin.
Changed hook location, added enable/disable setting and a setting to exclude usergroups.

winky8300 05-31-2014 07:26 AM

thank you

AK47- 06-01-2014 02:27 AM

Quote:

Originally Posted by Dave (Post 2500121)
I updated the plugin.
Changed hook location, added enable/disable setting and a setting to exclude usergroups.

Could you also get it to log all actions for admins in a more advanced way? Also thanks for the update.

Dave 06-01-2014 09:25 AM

Quote:

Originally Posted by AK47- (Post 2500292)
Could you also get it to log all actions for admins in a more advanced way? Also thanks for the update.

Could you elaborate this?

Skyrider 06-05-2014 07:08 AM

When you 'filter' someone (eg, a userID or username) it only shows a single page of results and hiding the rest with no next page, etc. Might be a slight bug/issue.

Dave 06-05-2014 07:49 AM

Quote:

Originally Posted by Skyrider (Post 2500751)
When you 'filter' someone (eg, a userID or username) it only shows a single page of results and hiding the rest with no next page, etc. Might be a slight bug/issue.

Working on this! Can expect an update soon.

Dave 06-05-2014 10:28 AM

5 June 2014: Fixed searching only showing the last 25 entries. Pagination will now work as intended.

In case you have this product installed already, you only have to replace the loginlog.php file in the admincp folder.

Bluemax712 06-10-2014 04:40 PM

I've installed on 2 different test servers both which have a prefix for all the vbulletin tables of "vb_"

When importing the product it creates the loginlog table with the correct "vb_loginlog" name
but when trying to login afterwards using the "login.php" - it gets an error because it's not adding the prefix of "vb_"
ie:
Table 'mydbname.loginlog' doesn't exist

It should be using mydbname.vb_loginlog

Hope this makes sense :)

Dave 06-11-2014 08:28 AM

Quote:

Originally Posted by Bluemax712 (Post 2501408)
I've installed on 2 different test servers both which have a prefix for all the vbulletin tables of "vb_"

When importing the product it creates the loginlog table with the correct "vb_loginlog" name
but when trying to login afterwards using the "login.php" - it gets an error because it's not adding the prefix of "vb_"
ie:
Table 'mydbname.loginlog' doesn't exist

It should be using mydbname.vb_loginlog

Hope this makes sense :)

Oops forgot about that. Fixed in V4, now available to download.

Bluemax712 06-11-2014 02:02 PM

With the v4 update can now login without error and view the log
but when purging the log it shows error

also when viewing log and filter on "userid" but leave the search term blank
it shows error

Dave 06-12-2014 08:15 AM

Quote:

Originally Posted by Bluemax712 (Post 2501493)
With the v4 update can now login without error and view the log
but when purging the log it shows error

also when viewing log and filter on "userid" but leave the search term blank
it shows error

Could you give me the errors? It's kind of a guess game now? :P

Bluemax712 06-12-2014 12:20 PM

When purging the log it doesn't show much even with debugging enabled
=========================================

Database error in vBulletin 4.2.0:

Invalid SQL:
;

MySQL Error :
Error Number : 0
Script : http://.../admincp/loginlog.php?do=purgenow
Referrer : http://.../admincp/loginlog.php?do=purge

Classname : vB_Database
MySQL Version :

Stack Trace:
#0 vB_Database->halt() called in [path]/includes/class_core.php on line 426
#1 vB_Database->execute_query() called in [path]/admincp/loginlog.php on line 41

=========================================
=========================================

Though when filtering on the blank userid it does give this for an error:

Database error in vBulletin 4.2.0:

Invalid SQL:
SELECT a.userid, b.username, a.loginstamp, a.ip, a.isp, a.country, a.browser FROM vb_loginlog a INNER JOIN vb_user b ON a.userid = b.userid WHERE a.userid = ORDER BY a.id DESC LIMIT 0,25;

MySQL Error : You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'ORDER BY a.id DESC LIMIT 0,25' at line 1
Error Number : 1064

Script : http://.../admincp/loginlog.php?do=&value=&type=1
Referrer : http://.../admincp/loginlog.php?do=&value=192&type=1

Classname : vB_Database
MySQL Version : 5.0.95-log

Stack Trace:
#0 vB_Database->halt() called in [path]/includes/class_core.php on line 426
#1 vB_Database->execute_query() called in [path]/includes/class_core.php on line 459
#2 vB_Database->query_read() called in [path]/admincp/loginlog.php on line 83

============================================

EDIT:
noticed all the other blank queries work but they use "LIKE" instead of "=":

SELECT a.userid, b.username, a.loginstamp, a.ip, a.isp, a.country, a.browser FROM vb_loginlog a INNER JOIN vb_user b ON a.userid = b.userid WHERE b.username LIKE '%%' ORDER BY a.id DESC LIMIT 0,25

SELECT a.userid, b.username, a.loginstamp, a.ip, a.isp, a.country, a.browser FROM vb_loginlog a INNER JOIN vb_user b ON a.userid = b.userid WHERE a.ip LIKE '%%' ORDER BY a.id DESC LIMIT 0,25

SELECT a.userid, b.username, a.loginstamp, a.ip, a.isp, a.country, a.browser FROM vb_loginlog a INNER JOIN vb_user
b ON a.userid = b.userid WHERE a.loginstamp LIKE '%%' ORDER BY a.id DESC LIMIT 0,25

SELECT a.userid, b.username, a.loginstamp, a.ip, a.isp, a.country, a.browser FROM vb_loginlog a INNER JOIN vb_user
b ON a.userid = b.userid WHERE a.isp LIKE '%%' ORDER BY a.id DESC LIMIT 0,25

SELECT a.userid, b.username, a.loginstamp, a.ip, a.isp, a.country, a.browser FROM vb_loginlog a INNER JOIN vb_user
b ON a.userid = b.userid WHERE a.country LIKE '%%' ORDER BY a.id DESC LIMIT 0,25

SELECT a.userid, b.username, a.loginstamp, a.ip, a.isp, a.country, a.browser FROM vb_loginlog a INNER JOIN vb_user
b ON a.userid = b.userid WHERE a.browser LIKE '%%' ORDER BY a.id DESC LIMIT 0,25

=====================
EDIT2:
When filling in the userid filter with a number it does work though :
SELECT a.userid, b.username, a.loginstamp, a.ip, a.isp, a.country, a.browser FROM vb_loginlog a INNER JOIN vb_user
b ON a.userid = b.userid WHERE a.userid = 1 ORDER BY a.id DESC LIMIT 0,25

EvoDarrenshan 06-12-2014 02:29 PM

Hello, Cloudflare... Is a problem. If i use cloudflare it will display cloudflare IP's. Can you fix this?

Dave 06-12-2014 03:30 PM

Quote:

Originally Posted by Bluemax712 (Post 2501630)
When purging the log it doesn't show much even with debugging enabled
=========================================

Database error in vBulletin 4.2.0:

Invalid SQL:
;

MySQL Error :
Error Number : 0
Script : http://.../admincp/loginlog.php?do=purgenow
Referrer : http://.../admincp/loginlog.php?do=purge

Classname : vB_Database
MySQL Version :

Stack Trace:
#0 vB_Database->halt() called in [path]/includes/class_core.php on line 426
#1 vB_Database->execute_query() called in [path]/admincp/loginlog.php on line 41

=========================================
=========================================

Though when filtering on the blank userid it does give this for an error:

Database error in vBulletin 4.2.0:

Invalid SQL:
SELECT a.userid, b.username, a.loginstamp, a.ip, a.isp, a.country, a.browser FROM vb_loginlog a INNER JOIN vb_user b ON a.userid = b.userid WHERE a.userid = ORDER BY a.id DESC LIMIT 0,25;

MySQL Error : You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'ORDER BY a.id DESC LIMIT 0,25' at line 1
Error Number : 1064

Script : http://.../admincp/loginlog.php?do=&value=&type=1
Referrer : http://.../admincp/loginlog.php?do=&value=192&type=1

Classname : vB_Database
MySQL Version : 5.0.95-log

Stack Trace:
#0 vB_Database->halt() called in [path]/includes/class_core.php on line 426
#1 vB_Database->execute_query() called in [path]/includes/class_core.php on line 459
#2 vB_Database->query_read() called in [path]/admincp/loginlog.php on line 83

============================================

EDIT:
noticed all the other blank queries work but they use "LIKE" instead of "=":

SELECT a.userid, b.username, a.loginstamp, a.ip, a.isp, a.country, a.browser FROM vb_loginlog a INNER JOIN vb_user b ON a.userid = b.userid WHERE b.username LIKE '%%' ORDER BY a.id DESC LIMIT 0,25

SELECT a.userid, b.username, a.loginstamp, a.ip, a.isp, a.country, a.browser FROM vb_loginlog a INNER JOIN vb_user b ON a.userid = b.userid WHERE a.ip LIKE '%%' ORDER BY a.id DESC LIMIT 0,25

SELECT a.userid, b.username, a.loginstamp, a.ip, a.isp, a.country, a.browser FROM vb_loginlog a INNER JOIN vb_user
b ON a.userid = b.userid WHERE a.loginstamp LIKE '%%' ORDER BY a.id DESC LIMIT 0,25

SELECT a.userid, b.username, a.loginstamp, a.ip, a.isp, a.country, a.browser FROM vb_loginlog a INNER JOIN vb_user
b ON a.userid = b.userid WHERE a.isp LIKE '%%' ORDER BY a.id DESC LIMIT 0,25

SELECT a.userid, b.username, a.loginstamp, a.ip, a.isp, a.country, a.browser FROM vb_loginlog a INNER JOIN vb_user
b ON a.userid = b.userid WHERE a.country LIKE '%%' ORDER BY a.id DESC LIMIT 0,25

SELECT a.userid, b.username, a.loginstamp, a.ip, a.isp, a.country, a.browser FROM vb_loginlog a INNER JOIN vb_user
b ON a.userid = b.userid WHERE a.browser LIKE '%%' ORDER BY a.id DESC LIMIT 0,25

=====================
EDIT2:
When filling in the userid filter with a number it does work though :
SELECT a.userid, b.username, a.loginstamp, a.ip, a.isp, a.country, a.browser FROM vb_loginlog a INNER JOIN vb_user
b ON a.userid = b.userid WHERE a.userid = 1 ORDER BY a.id DESC LIMIT 0,25

Does your MySQL user have access to the TRUNCATE function?
The query itself is correct to truncate the table.

I will fix the other error if you search for nothing, although it doesn't have any priority.

Quote:

Originally Posted by EvoDarrenshan (Post 2501644)
Hello, Cloudflare... Is a problem. If i use cloudflare it will display cloudflare IP's. Can you fix this?

Please refer to https://support.cloudflare.com/hc/en...ith-vBulletin-

Bluemax712 06-12-2014 04:44 PM

Quote:

Originally Posted by Dave (Post 2501652)
Does your MySQL user have access to the TRUNCATE function?
The query itself is correct to truncate the table.

I will fix the other error if you search for nothing, although it doesn't have any priority.

hmm ... not sure exactly how to check access to the truncate function
but running 'show grants' from the mysql command line for the user says:
GRANT ALL PRIVILEGES ON ...WITH GRANT OPTION

===============================
EDIT
running this manually from command line worked :
TRUNCATE vb_loginlog;

but using the loginlog control panel purge function just gives the first error above - like it's not getting any input

Bluemax712 06-12-2014 06:32 PM

I changed loginlog.php to use "query_write" vs. "execute_query" and it seems to work now
not sure if this is proper way to use it though ...i'm only a former sysadmin and not much of a programmer:)

$db->query_write("TRUNCATE TABLE " . TABLE_PREFIX . "loginlog");

EvoDarrenshan 06-14-2014 07:30 PM

Quote:

Originally Posted by Bluemax712 (Post 2501660)
hmm ... not sure exactly how to check access to the truncate function
but running 'show grants' from the mysql command line for the user says:
GRANT ALL PRIVILEGES ON ...WITH GRANT OPTION

===============================
EDIT
running this manually from command line worked :
TRUNCATE vb_loginlog;

but using the loginlog control panel purge function just gives the first error above - like it's not getting any input

Already did that sir, Still shows cloudflare IP's.

Skyrider 08-17-2014 01:47 PM

I've altered the loginlog plugin so it logs in mostly all places on the forums (forumhome/forumdisplay), but after a while the loginlog.php is taking ages to load. Is there a way that this system logs on all pages, and "only" logs new information of a user when either the browser OR ip of that user has changed?

Dave 08-17-2014 01:49 PM

Quote:

Originally Posted by Skyrider (Post 2511693)
I've altered the loginlog plugin so it logs in mostly all places on the forums (forumhome/forumdisplay), but after a while the loginlog.php is taking ages to load. Is there a way that this system logs on all pages, and "only" logs new information of a user when either the browser OR ip of that user has changed?

Yea that is possible. A matter of selecting the latest record of the user and compare the IP/browser with the current one, then if there's a mismatch you just log the entry.

madness85 08-17-2014 02:49 PM

Very nice I will be installing :)

Got some ideas :)
It would be great if it could detect ip & create a thread.
Auto prune ips would be nice with option how many days it prunes.

X-or 02-20-2015 07:18 PM

I do not trust any external content, can you make a version without it please? Thank you.

Dave 02-21-2015 10:11 AM

Quote:

Originally Posted by X-or (Post 2538125)
I do not trust any external content, can you make a version without it please? Thank you.

It makes a call to a third party API to get certain information about the IP address such as the ISP/country, etc. I'm not going to make it dependent of nginx/Apache modules so sorry, it will remain as it is. But really, it's no big deal.

X-or 02-23-2015 11:25 PM

Most of the time, it may not be big deal indeed, but it's a different story on privacy aware websites. That would violate our current privacy policy.

Dave 02-24-2015 08:20 AM

Quote:

Originally Posted by X-or (Post 2538500)
Most of the time, it may not be big deal indeed, but it's a different story on privacy aware websites. That would violate our current privacy policy.

The API I use is open-source so you could simply integrate it on your own server and change the API URL I call in the script to your own local URL. https://github.com/fcambus/telize

sevenmix 02-24-2015 07:07 PM

How do i give full access to this product to a s-mod?

Dave 02-24-2015 07:11 PM

Quote:

Originally Posted by sevenmix (Post 2538603)
How do i give full access to this product to a s-mod?

Unfortunately it's only accessible in the admincp.

X-or 03-10-2015 12:15 PM

Quote:

Originally Posted by Dave (Post 2538533)
The API I use is open-source so you could simply integrate it on your own server and change the API URL I call in the script to your own local URL. https://github.com/fcambus/telize

thanks! good to know :-)

jscherbel 10-05-2015 02:29 PM

Looks like telize.com no longer exists so this is now preventing logins to my site and my administrative area. Anyone know how to disable it from the database level directly?

Update: I went into the file that throws the error/warning about cookies and commented out the line that contains the eval() (line 204 of my functions_login.php). Logged into the administrative panel. Disabled the mod. Re-added the code I commented out. Hope that helps someone else.

Thanks!

Dave 10-06-2015 07:03 AM

Quote:

Originally Posted by jscherbel (Post 2556326)
Looks like telize.com no longer exists so this is now preventing logins to my site and my administrative area. Anyone know how to disable it from the database level directly?

Update: I went into the file that throws the error/warning about cookies and commented out the line that contains the eval() (line 204 of my functions_login.php). Logged into the administrative panel. Disabled the mod. Re-added the code I commented out. Hope that helps someone else.

Thanks!

That's weird, the site still seems online to me. Maybe it was down for a little bit?

friendlymela 10-07-2015 07:50 AM

good for the security

blah100 10-07-2015 04:32 PM

Getting this database error after a login from a certain member:

Quote:

Invalid SQL:
INSERT INTO loginlog (userid, username, loginstamp, browser, ip, isp, country) VALUES (24528, 'membername', NOW(), 'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/45.0.2454.101 Safari/537.36', 'IP number', '', '');

MySQL Error : You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'membername', NOW(), 'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (' at line 1
Error Number : 1064
It's the same member, and a database error happens for each login attempt. Is it the case that if a member fails in trying to login that this database error happens?

Dave 10-08-2015 08:20 AM

Quote:

Originally Posted by blah100 (Post 2556513)
Getting this database error after a login from a certain member:



It's the same member, and a database error happens for each login attempt. Is it the case that if a member fails in trying to login that this database error happens?

I uploaded a new version which should fix that.

sevenmix 01-13-2016 03:38 AM

Hi, im getting this error after i installed php 5.5:

in /home/********/public_html/includes/functions_login.php(204) : eval()'d code on line 102
[13-Jan-2016 05:37:04 UTC] PHP Warning: file_get_contents(http://www.telize.com/geoip/***.4.219.***): failed to open stream: HTTP request failed! HTTP/1.1 404 Not Found

What could be the problem? greetings.

z3r0 01-13-2016 06:28 AM

Telize have a notice on the front page of their site that they have shut down the public API, that is probably the cause.


All times are GMT. The time now is 06:21 PM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01523 seconds
  • Memory Usage 1,852KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (19)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (40)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete