The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
||||
|
||||
Logging IP Addresses - is there a mod for this?
I have a member who thinks his account has been accessed by someone else. He's been a member for several years and has never posted so only one IP address shows in his account profile. I'm assuming that vB only logs IPs when a user posts (please correct me if I'm wrong).
Is there a mod, or any way to view IPs that have accessed an account over a certain period of time? Any assistance would be truly appreciated. Thanks! Using 3.8.6 btw |
#2
|
|||
|
|||
I was going to use this for something I was working on: create a plugin with hook location global_complete and this code:
Code:
if ($vbulletin->userinfo['userid'] AND $vbulletin->session->created) { $fp = @fopen('memberips.log', 'a'); // <--- add path to writable directory if (!empty($fp)) { fwrite($fp, IPADDRESS . ',' . $vbulletin->userinfo['userid'] . ',' . $vbulletin->db->escape_string($vbulletin->userinfo['username']) . "\n"); fclose($fp); } } In any case, this logs the user name, id, and ip whenever a session is created. You would probably want to add the data/time to this. Note: I think this will be OK but I didn't try it on a busy site. I also don't know if the info might somehow already be available from the web server logs. ETA: of course you could also add a check for the userid if you only want to log that one user. |
#3
|
|||
|
|||
Thank you kh99. That is a very useful code.
|
#4
|
|||
|
|||
Thank you very much for this code.
--------------- Added [DATE]1353004307[/DATE] at [TIME]1353004307[/TIME] --------------- Same thing with timestamps added, Code:
if ($vbulletin->userinfo['userid'] AND $vbulletin->session->created) { $fp = @fopen('memberips.log', 'a'); // <--- add path to writable directory if (!empty($fp)) { fwrite($fp, vbdate($vbulletin->options['dateformat'] . ',' . $vbulletin->options['timeformat']) . ',' . $vbulletin->userinfo['userid'] . ',' . $vbulletin->db->escape_string($vbulletin->userinfo['username']) . ',' . IPADDRESS . "\n"); } } |
#5
|
||||
|
||||
Very useful, thanks guys! Any obvious changes needed for it to work on vB4?
|
#6
|
||||
|
||||
One thing I noticed with this, is that it only adds it to one line, there is no carriage return after each entry.
--------------- Added [DATE]1382216131[/DATE] at [TIME]1382216131[/TIME] --------------- Got it, needed to add \r |
Thread Tools | |
Display Modes | |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|