vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   Modification Requests/Questions (Unpaid) (https://vborg.vbsupport.ru/forumdisplay.php?f=112)
-   -   Log user ip every visit (https://vborg.vbsupport.ru/showthread.php?t=77414)

Paul M 03-27-2005 09:36 PM

Quote:

Originally Posted by MarcoH64
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...

Code:

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...
Code:

require_once('./includes/functions.php');
RIGHT BELOW IT ADD.

Code:

include_once ( './includes/functions_visitors.php' );
close that file...

Go to ./includes/

Open functions.php

FIND THIS LINE...
Code:

$output = process_replacement_vars($vartext, $sendheader);

RIGHT BELOW IT ADD
Code:

log_write ( strlen ( $output ) );
close functions.php


In that same directory './includes/'

create a file called...
Code:

functions_visitors.php

In that file paste the following code!

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

Viks 03-27-2005 10:42 PM

"LOGIN LOG" mod does this already!!

search here for the keyword login log.

why-not 03-27-2005 10:51 PM

Quote:

Originally Posted by Viks
"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


Quote:

Originally Posted by Sleepyk
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

Quote:

Originally Posted by djjeffa
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:

j_86 03-28-2005 01:44 PM

Quote:

Originally Posted by Sleepyk
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.


All times are GMT. The time now is 07:07 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.01237 seconds
  • Memory Usage 1,743KB
  • 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
  • (7)bbcode_code_printable
  • (5)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (2)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (10)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