Page 1 of 3

[Release] NV Who was here? Add-On

Posted: Sun 20. Jun 2010, 11:11
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 2464 times

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

Posted: Mon 19. Jul 2010, 13:00
by darkonia
must it the who was here version 1.0.2 or can i use it also with version 1.0.0 ?

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

Posted: Mon 19. Jul 2010, 13:49
by Marc
I only tested it with NV Who was here? 1.0.2, but it might work with 1.0.0.

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

Posted: Fri 23. Jul 2010, 13:42
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()

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

Posted: Tue 10. Aug 2010, 09:17
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

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

Posted: Fri 3. Sep 2010, 12:59
by Nashra
Hi,

keine Idee woran dies liegt :?:

Gruß
Ralf

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

Posted: Sat 4. Sep 2010, 09:14
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.

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

Posted: Mon 6. Sep 2010, 15:21
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

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

Posted: Tue 7. Sep 2010, 16:32
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

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

Posted: Sun 17. Oct 2010, 16:00
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 2286 times
Only languaje file:
es.zip
(1.22 KiB) Downloaded 2274 times
Translation by Richi Knight http://la-futboleria.com

Rewards from Spain.