The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
|||
|
|||
Log IPs in external logfile
Hi,
is it possible to log the IPs of all users in an external logfile and NOT in the vBulletin Software. Maybe with some different options like ip|username|time|.. Is it possible via e.g. a script? |
#2
|
|||
|
|||
Push it up.
|
#3
|
|||
|
|||
It's possible, but you need to be a bit more specific about what info you want to have in the log file
|
#4
|
|||
|
|||
Ok.
Instead of logging the ips in the forum I want to log them extern. Maybe there should be one logfile for one day. The file should contain all user who have access on this day with their ip adresses, their username and the time they were online with this ip. Is that enough information? :-) |
#5
|
|||
|
|||
If you just wanted to log the info every time someone accessed a page, you could probably do it in global_start plugin and just fwrite a line to a file, something like:
Code:
$logdir = DIR . '/iplogs'; $logfile = $logdir . '/' . date('Y-m-d', TIMENOW) . '_ip.log'; $fp = fopen($logfile, 'a'); fwrite($fp, IPADDRESS . '|' . $vbulletin->userinfo['username'] . '|' . date(DATE_RFC1123, TIMENOW) . "\n"); fclose($fp); But what you'd probably want is to log every time a session gets created and not every time a page is requested, and I don't know how you'd do that. There are no hooks where the session gets created (maybe because it's too early and the hook mechanisms haven't been initialized, or maybe just that you shouldn't be messing with it, I don't know). Still, you could edit the files if you really wanted to and you understood the session creation logic. Maybe someone else can help. BTW, I tried the above and noticed that every page access got me two logged lines, one like I'd expect, and another with "Unregistered" and the user name. I don't know why. ETA: curiosity got the best of me so I also logged $_SERVER['REQUEST_URI'] and found out that the 'Unregistered' lines are coming from the thing that gets inserted to run cron jobs. ETA: By coincidence I had reason to look in to some of this stuff, and I found that there's a $vbulletin->session->created that is true only on the page where the session is created, so by checking this you can log only new sessions, or "visits", if that's what you want. One thing about that, if the user is actually logging in it might not contain their user name yet, but I think you could get around that by loggin at a later hook (like maybe global_complete). |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|