View Full Version : Log user ip every visit
djjeffa
03-03-2005, 08:51 PM
Is ther a hack that could log the users ip every visit so we could see alle the ips there using like if they have more then one pc?
I think it would help when banning members.
ericgtr
03-03-2005, 09:16 PM
It's already built in. Admin CP > Users > 'find user' > Quick User Links (dropdown at the top of the user page) > View IP Addresses.
Paul M
03-03-2005, 09:38 PM
I think he means every visit, not just when people post.
djjeffa
03-04-2005, 02:09 AM
I think he means every visit, not just when people post.
right you are pauly :nervous:
djjeffa
03-19-2005, 09:59 PM
Bump?
djjeffa
03-27-2005, 06:50 PM
ok one more bump then i give up Im sure a coder could figer this out eazaly
Marco van Herwaarden
03-27-2005, 06:59 PM
And what should it do, every IP used once? Or every single time time he visits complete with timestamp? Every pageload logged seperate?
Sleepyk
03-27-2005, 07:50 PM
the ip finder logges each ip a user logs in with, if u want how many time that may be a tiny hack but not needed
Marco van Herwaarden
03-27-2005, 08:35 PM
It could be done, but it would probably add 1 or 2 queries to every page load.
Sleepyk
03-27-2005, 09:28 PM
and in reality is pretty pointless
Paul M
03-27-2005, 09:36 PM
It could be done, but it would probably add 1 or 2 queries to every page load.and also add lots of somewhat pointless records to the database.
why-not
03-27-2005, 10:36 PM
Hi
Just create a directory out of the server web root to store the log then just log ip's into that, then every hour run a cron to add them to the database if you want to do that or if you just want to log it into the database create a table and do it that way....
example....
log into the database!
create a table...
CREATE TABLE visitors (
ip char(15) NOT NULL default '000.000.000.000',
visits smallint(5) unsigned NOT NULL default '0',
last int(10) unsigned NOT NULL default '0',
content int(10) unsigned NOT NULL default '0',
UNIQUE KEY visitors_ip (ip),
KEY visitors_ip (ip)
);
Go to your install directory!
Open global.php
FIND THIS LINE...
require_once('./includes/functions.php');
RIGHT BELOW IT ADD.
include_once ( './includes/functions_visitors.php' );
close that file...
Go to ./includes/
Open functions.php
FIND THIS LINE...
$output = process_replacement_vars($vartext, $sendheader);
RIGHT BELOW IT ADD
log_write ( strlen ( $output ) );
close functions.php
In that same directory './includes/'
create a file called...
functions_visitors.php
In that file paste the following code!
<?php
function get_ip ()
{
$ip = !empty ( $_SERVER['CLIENT_IP'] ) ? $_SERVER['CLIENT_IP'] : '';
$ip = !empty ($_SERVER['HTTP_X_FORWARDED_FOR'] ) && empty ( $ip ) ? $_SERVER['HTTP_X_FORWARDED_FOR'] : $ip;
$ip = !empty ( $_SERVER['REMOTE_ADDR'] ) && empty ( $ip ) ? $_SERVER['REMOTE_ADDR'] : $ip;
return $ip;
}
function log_write ( $sent )
{
global $DB_site;
$user = addslashes ( get_ip () );
$sent = intval ( $sent );
$time = time ();
$DB_site->query ( "INSERT INTO " . TABLE_PREFIX . "visitors VALUES ( '" . $user . "', 1, " . $time . ", " . $sent . " ) ON DUPLICATE KEY UPDATE last = " . $time . ", visits = visits + 1, content = content + " . $sent );
}
?>
That it...
It will log UNIQUE VISITORS, total pages viewed, total bandwidth used and their last visit time!
Note if your using a table PREFIX be sure to add the PREFIX to the CREATE table and the keys before creating the table! If you want to know how to add a simple viewer in the Admin Panel to view the log, just ask and I will show you how simple it is! It will have to be tomorrow evening as I have no time now, busy reading at the moment!!!
Sonia
"LOGIN LOG" mod does this already!!
search here for the keyword login log.
why-not
03-27-2005, 10:51 PM
"LOGIN LOG" mod does this already!!
search here for the keyword login log.
It's not the same thing! "LOGIN LOG", only logs logins! Not all visitors, like djjeffa requested!
Sonia
KanyeWest
03-27-2005, 11:09 PM
Cool :ermm:
djjeffa
03-27-2005, 11:50 PM
thank you Sonia
and in reality is pretty pointless
well I have lots of sneaky members that I would like to watch and they keep making new user names and some have more then one pc.
KanyeWest
03-28-2005, 01:42 AM
thank you Sonia
well I have lots of sneaky members that I would like to watch and they keep making new user names and some have more then one pc.
Hey Hey Hey im not sneaky :ermm: :ermm: i paid :devious:
and in reality is pretty pointless
Far from pointless from my point of view. Large gaming communities, and sometimes we need to back trace IPs from users from a long way back.
sim tech
05-23-2005, 08:53 PM
I could also use it. My site is a specific career orientated forum, and members post things like payscale comparisons & job problems.
I'd love to see a mod where it would show a log of all IP addresses that visited the site, not just the ones that logged in. If a user posts something about "ABC company", then I want to see if any IP addresses of "ABC company" have visited the forum, even as just a guest.
vanayr
08-11-2005, 10:05 PM
Is there a way for this to log to a text file, maby comma seperated? This is exactly what I've been looking for.
Jenta
08-12-2005, 01:35 AM
a session logger is what we need
username, ip, date
vanayr
09-04-2005, 12:44 AM
a session logger is what we need
username, ip, date
Amen, would love this. As some folks pointed out, I could use a list of every visitor to the site.
vanayr
10-16-2005, 10:43 PM
Cool :ermm:
Sonia, if you still check this forum, could you by chance show us how to create the AdminCP for this? This module is perfect.
vBulletin® v3.8.12 by vBS, Copyright ©2000-2024, vBulletin Solutions Inc.