[Release] NV Who was here? Add-On

User avatar
Marc
Administrator
Administrator
Posts: 620
Joined: Tue 2. Sep 2008, 22:48
phpbb.com: Marc
Location: Munich
Contact:

[Release] NV Who was here? Add-On

Post by Marc »

Add-On: NV Who was here?
Add-On Version: 1.0.0
Add-On Description:
Addon for phpBB Statistics that will display statistics about NV Who was here? by nickvergessen:
  • Total visited users
  • Total visited Registered Users
  • Total visited Guests
  • Total visited Bots
  • Total visited Hidden Users
  • Total visits
  • Number of visited Users (per defined timeframe)
  • Number of visited Registered Users (per defined timeframe)
  • Number of visited Guests (per defined timeframe)
  • Number of visited Bots (per defined timeframe)
  • Number of visited Hidden Users (per defined timeframe)
  • Visits by day time
  • Top 10 users (by visits)
Add-On Requirements: phpBB Statistics 1.0.2(Download) & NV Who was here? 1.0.2 by nickvergessen(Download)

Add-On Author: Marc Alexander
phpBB Version: 3.0.7-PL1
phpBB Styles: prosilver
Languages: English, German

Anleitung / Instructions:
[+] Anleitung - DE
Lade das Archiv herunter und extrahiere es. Lade alle Dateien und Ordner innerhalb des root Verzeichnisses in dein Foren Hauptverzeichnis hoch.

Öffne includes/functions_wwh.php
Finde:

Code: Select all

function update_who_was_here_session ()
{
    global $phpbb_root_path, $db, $user;

    if ($user->data['user_id'] != ANONYMOUS)
    { 
Danach einfügen:

Code: Select all

        /*     
        * phpBB Statistics - NV Who was here? Add-On
        * by Marc Alexander (c) 2010
        */        
        global $table_prefix;
        
        if (!defined('STATS_WWH_TABLE'))
        {
            define('STATS_WWH_TABLE', $table_prefix . 'stats_wwh');
        }
        $db->sql_return_on_error(true); // I don't care if it's a duplicate and the user doesn't care
        $sql = 'INSERT INTO ' . STATS_WWH_TABLE .  ' ' . $db->sql_build_array('INSERT', array(
                        'name' => (int) time(),
                        'data' => (int) $user->data['user_id']));
        $db->sql_query($sql);
        $db->sql_return_on_error(false);
        // NV Who was here? Add-On -- END --   
Finde:

Code: Select all

    else
    {
        $timestamp_cleaning = $timestamp - ((3600 * $config['wwh_del_time_h']) + (60 * $config['wwh_del_time_m']) + $config['wwh_del_time_s']);
    }

    if ((!isset($config['wwh_last_clean']) || ($config['wwh_last_clean'] != $timestamp_cleaning)) || !$config['wwh_version'])
    { 
Danach einfügen:

Code: Select all

        /*     
        * phpBB Statistics - NV Who was here? Add-On
        * by Marc Alexander (c) 2010
        */
        global $table_prefix;
        define('STATS_WWH_TABLE', $table_prefix . 'stats_wwh');
        
        $sql = 'SELECT name, data
                FROM  ' . STATS_WWH_TABLE . "
                WHERE name = 'last_purge'";
        $result = $db->sql_query($sql);
        $last_purge = $db->sql_fetchfield('data');
        if($config['wwh_version'] || ($last_purge <= $timestamp_cleaning))
        {
            $wwh_count_total = $wwh_count_reg = $wwh_count_guests = $wwh_count_bot = $wwh_count_hidden = 0;
            
            $user_id_ary = array();

            $sql = 'SELECT user_id, user_type, viewonline
                FROM  ' . WWH_TABLE . "
                ORDER BY user_id ASC";
            $result = $db->sql_query($sql);

            while ($row = $db->sql_fetchrow($result))
            {
                if (!in_array($row['user_id'], $user_id_ary))
                {
                    // At the end let's count them =)
                    if ($row['user_id'] == ANONYMOUS)
                    {
                        ++$wwh_count_guests;
                    }
                    else if ($row['user_type'] == USER_IGNORE)
                    {
                        ++$wwh_count_bot;
                    }
                    else if ($row['viewonline'] == 1)
                    {
                        ++$wwh_count_reg;
                    }
                    else
                    {
                        ++$wwh_count_hidden;
                    }
                    ++$wwh_count_total;
                }
            }
            $db->sql_freeresult($result);
            
            $insert_var = $wwh_count_total . ',' . $wwh_count_reg . ',' . $wwh_count_guests . ',' . $wwh_count_bot . ',' . $wwh_count_hidden;
            
            $sql = 'INSERT INTO ' . STATS_WWH_TABLE . ' ' . $db->sql_build_array('INSERT', array(
                            'name'    => (int) time(),
                            'data'  => $db->sql_escape($insert_var)));
            $db->sql_query($sql);
            
            $sql = 'UPDATE ' . STATS_WWH_TABLE . ' SET data = ' . time() . " WHERE name = 'last_purge'";
            $result = $db->sql_query($sql);
            if(!$db->sql_affectedrows($result))
            {
                $sql = 'INSERT INTO ' . STATS_WWH_TABLE . " (name, data) VALUES('last_purge', '" . time() . "');";
                $db->sql_query($sql);
            }
            $db->sql_freeresult($sql);
        }
        // NV Who was here? Add-On -- END --   

Danach folge einfach dem folgenden How To:
http://www.m-a-styles.de/viewtopic.php? ... p=569#p569
[+] Instructions - EN
Download the Archive and extract it. Upload all files and folders inside the root folder to your forum root.

Open includes/functions_wwh.php
Find:

Code: Select all

function update_who_was_here_session ()
{
    global $phpbb_root_path, $db, $user;

    if ($user->data['user_id'] != ANONYMOUS)
    {  
Add after:

Code: Select all

        /*     
        * phpBB Statistics - NV Who was here? Add-On
        * by Marc Alexander (c) 2010
        */        
        global $table_prefix;
        
        if (!defined('STATS_WWH_TABLE'))
        {
            define('STATS_WWH_TABLE', $table_prefix . 'stats_wwh');
        }
        $db->sql_return_on_error(true); // I don't care if it's a duplicate and the user doesn't care
        $sql = 'INSERT INTO ' . STATS_WWH_TABLE .  ' ' . $db->sql_build_array('INSERT', array(
                        'name' => (int) time(),
                        'data' => (int) $user->data['user_id']));
        $db->sql_query($sql);
        $db->sql_return_on_error(false);
        // NV Who was here? Add-On -- END --   
Find:

Code: Select all

    else
    {
        $timestamp_cleaning = $timestamp - ((3600 * $config['wwh_del_time_h']) + (60 * $config['wwh_del_time_m']) + $config['wwh_del_time_s']);
    }

    if ((!isset($config['wwh_last_clean']) || ($config['wwh_last_clean'] != $timestamp_cleaning)) || !$config['wwh_version'])
    {  
Add after:

Code: Select all

        /*     
        * phpBB Statistics - NV Who was here? Add-On
        * by Marc Alexander (c) 2010
        */
        global $table_prefix;
        define('STATS_WWH_TABLE', $table_prefix . 'stats_wwh');
        
        $sql = 'SELECT name, data
                FROM  ' . STATS_WWH_TABLE . "
                WHERE name = 'last_purge'";
        $result = $db->sql_query($sql);
        $last_purge = $db->sql_fetchfield('data');
        if($config['wwh_version'] || ($last_purge <= $timestamp_cleaning))
        {
            $wwh_count_total = $wwh_count_reg = $wwh_count_guests = $wwh_count_bot = $wwh_count_hidden = 0;
            
            $user_id_ary = array();

            $sql = 'SELECT user_id, user_type, viewonline
                FROM  ' . WWH_TABLE . "
                ORDER BY user_id ASC";
            $result = $db->sql_query($sql);

            while ($row = $db->sql_fetchrow($result))
            {
                if (!in_array($row['user_id'], $user_id_ary))
                {
                    // At the end let's count them =)
                    if ($row['user_id'] == ANONYMOUS)
                    {
                        ++$wwh_count_guests;
                    }
                    else if ($row['user_type'] == USER_IGNORE)
                    {
                        ++$wwh_count_bot;
                    }
                    else if ($row['viewonline'] == 1)
                    {
                        ++$wwh_count_reg;
                    }
                    else
                    {
                        ++$wwh_count_hidden;
                    }
                    ++$wwh_count_total;
                }
            }
            $db->sql_freeresult($result);
            
            $insert_var = $wwh_count_total . ',' . $wwh_count_reg . ',' . $wwh_count_guests . ',' . $wwh_count_bot . ',' . $wwh_count_hidden;
            
            $sql = 'INSERT INTO ' . STATS_WWH_TABLE . ' ' . $db->sql_build_array('INSERT', array(
                            'name'    => (int) time(),
                            'data'  => $db->sql_escape($insert_var)));
            $db->sql_query($sql);
            
            $sql = 'UPDATE ' . STATS_WWH_TABLE . ' SET data = ' . time() . " WHERE name = 'last_purge'";
            $result = $db->sql_query($sql);
            if(!$db->sql_affectedrows($result))
            {
                $sql = 'INSERT INTO ' . STATS_WWH_TABLE . " (name, data) VALUES('last_purge', '" . time() . "');";
                $db->sql_query($sql);
            }
            $db->sql_freeresult($sql);
        }
        // NV Who was here? Add-On -- END --   
After that follow the instructions on how to add an Add-On:
http://www.m-a-styles.de/viewtopic.php? ... p=572#p572
Download:
nv_wwh_addon_1.0.0.zip
(9.62 KiB) Downloaded 2462 times
Image
darkonia
Mitglied / Member
Mitglied / Member
Posts: 5
Joined: Fri 30. Apr 2010, 15:14
phpbb.com: darkonia

Re: [Release] NV Who was here? Add-On

Post by darkonia »

must it the who was here version 1.0.2 or can i use it also with version 1.0.0 ?
User avatar
Marc
Administrator
Administrator
Posts: 620
Joined: Tue 2. Sep 2008, 22:48
phpbb.com: Marc
Location: Munich
Contact:

Re: [Release] NV Who was here? Add-On

Post by Marc »

I only tested it with NV Who was here? 1.0.2, but it might work with 1.0.0.
Image
darkonia
Mitglied / Member
Mitglied / Member
Posts: 5
Joined: Fri 30. Apr 2010, 15:14
phpbb.com: darkonia

Re: [Release] NV Who was here? Add-On

Post by darkonia »

ive get this error sometimes from your addon, only sometimes, not always xD
Allgemeiner Fehler
SQL ERROR [ mysql4 ]

Duplicate entry '1279888911' for key 1 [1062]

SQL

INSERT INTO phpbb_stats_wwh (name, data) VALUES (1279888911, '135,6,120,9,0')

BACKTRACE

FILE: includes/db/mysql.php
LINE: 174
CALL: dbal->sql_error()

FILE: includes/functions_wwh.php
LINE: 160
CALL: dbal_mysql->sql_query()

FILE: index.php
LINE: 401
CALL: display_who_was_here()
User avatar
Nashra
Mitglied / Member
Mitglied / Member
Posts: 15
Joined: Fri 7. May 2010, 11:48
Location: Geldern
Contact:

Re: [Release] NV Who was here? Add-On

Post by Nashra »

Hi Marc,

im Debugmodus wird mir dies angezeigt ;)

Code: Select all

[phpBB Debug] PHP Notice: in file /statistics/addons/stats_wwh.php on line 420: Undefined offset: 76
[phpBB Debug] PHP Notice: in file /statistics/addons/stats_wwh.php on line 420: Undefined offset: 76
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 4494: Cannot modify header information - headers already sent by (output started at /includes/functions.php:3518)
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 4495: Cannot modify header information - headers already sent by (output started at /includes/functions.php:3518)
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 4496: Cannot modify header information - headers already sent by (output started at /includes/functions.php:3518)
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 4497: Cannot modify header information - headers already sent by (output started at /includes/functions.php:3518)
Gruß
Ralf
„Die Menschen müssen lernen wieder zu sehen, was sie anschauen.
Sie müssen ihr Pferd fühlen, um es begreifen zu können.“

Tom Dorrance, 1910 - 2003
User avatar
Nashra
Mitglied / Member
Mitglied / Member
Posts: 15
Joined: Fri 7. May 2010, 11:48
Location: Geldern
Contact:

Re: [Release] NV Who was here? Add-On

Post by Nashra »

Hi,

keine Idee woran dies liegt :?:

Gruß
Ralf
„Die Menschen müssen lernen wieder zu sehen, was sie anschauen.
Sie müssen ihr Pferd fühlen, um es begreifen zu können.“

Tom Dorrance, 1910 - 2003
User avatar
Marc
Administrator
Administrator
Posts: 620
Joined: Tue 2. Sep 2008, 22:48
phpbb.com: Marc
Location: Munich
Contact:

Re: [Release] NV Who was here? Add-On

Post by Marc »

Kann es sein, dass du einen Benutzer in letzter Zeit gelöscht hast? Es scheint so als ob in der Datenbank noch ein Eintrag eines Benutzers ist, der nicht mehr existiert.
Image
User avatar
Nashra
Mitglied / Member
Mitglied / Member
Posts: 15
Joined: Fri 7. May 2010, 11:48
Location: Geldern
Contact:

Re: [Release] NV Who was here? Add-On

Post by Nashra »

Hi Marc,

hm, in der letzten Zeit sind so ca. 20 Mitglieder gelöscht worden....
habs nochmal aktiviert und jetzt ist mir was aufgefallen :o
bei Gesamtanzahl Besucher und den Anderen ist ein Eintrag doppelt
• 22.06.2010 10:59 89 1.697%
• 22.06.2010 10:59 - 23.06.2010 10:59 85 1.620%
Donnerwetter wo kommt das denn her....
Mal auf die Suche begeb, hoffentlich find ich den Datenbankeintrag

Gruß
Ralf
„Die Menschen müssen lernen wieder zu sehen, was sie anschauen.
Sie müssen ihr Pferd fühlen, um es begreifen zu können.“

Tom Dorrance, 1910 - 2003
User avatar
Nashra
Mitglied / Member
Mitglied / Member
Posts: 15
Joined: Fri 7. May 2010, 11:48
Location: Geldern
Contact:

Re: [Release] NV Who was here? Add-On

Post by Nashra »

Hm, war natürlich Quark mit dem doppelten Eintrag, ist ja der Starttag :lol:
Aber konnte soweit nichts finden, hab mal die Datenbankeinträge gelöscht
und das Ganze neu gestartet, mal sehen ob es noch mal auftritt wenn ich
jemanden lösche.

Gruß
Ralf
„Die Menschen müssen lernen wieder zu sehen, was sie anschauen.
Sie müssen ihr Pferd fühlen, um es begreifen zu können.“

Tom Dorrance, 1910 - 2003
Richi Knight
Newbie
Newbie
Posts: 2
Joined: Sun 17. Oct 2010, 15:48
Location: Madrid (Spain)
Contact:

Re: [Release] NV Who was here? Add-On

Post by Richi Knight »

Hi Marc, thanks for your MODs. This is the spanish translation for "NV Who was here? Add-On".
nv_wwh_addon_1.0.0-spanish.zip
(11.48 KiB) Downloaded 2285 times
Only languaje file:
es.zip
(1.22 KiB) Downloaded 2273 times
Translation by Richi Knight http://la-futboleria.com

Rewards from Spain.
Enjoy the soccer in La Futbolería
Post Reply