Логирование действий пользователей

Логирование действий пользователей 1.0.0

Нет прав для скачивания

Exile

Администратор
Пользователь Exile разместил новый ресурс:

Логирование действий пользователей - Добавляет логирование действий пользователей, их точное месторасположение на трекере.

Релиз согласно программе перехода платных модификаций в общественное достояние: https://torrentpier.com/threads/platnye-modifikacii-i-ix-dalnejshaja-podderzhka.36722/

Для работы на последних версиях движка требуется адаптация, задавайте вопросы по ней в теме.


Описание: добавляет логирование действий пользователей, их точное месторасположение на трекере.

Узнать больше об этом ресурсе...
 

Ress Kent

Пользователь
после установки, вместо сайта
Parse error: syntax error, unexpected ',' in C:\OpenServer\domains\**\library\includes\functions.php on line 2716
На эти строки жалуется
Код:
        case 'topic':
        case 'post':
            $topic = ($data['type'] == 'post') ? '<a href="'. (POST_URL . $data['id'] .'#'. $data['id'], $old_title) .'" target="_blank">'. $title .'</a>' : '<a href="'. (TOPIC_URL . $data['id'], $old_title) .'" target="_blank">'. $title .'</a>';
            return 'Просмотр темы '. $topic;
        break;

        case 'forum':
            $forum = '<a href="'. (FORUM_URL . $data['id'], $old_title) .'" target="_blank">'. $title .'</a>';
            return 'Просмотр форума '. $forum;
        break;

        case 'profile':
            return 'Просмотр профиля '. $title;
        break;

        case 'search':
            return 'Использует поиск по форуму';
        break;
Если по очередности удалять case, ошибка перепрыгивает на следующие строки
Мод такой большой, тяжело с ним разобраться
 

dredd

Пользователь
Версия для MySQL (не адаптированная)
 

Вложения

  • where_user_ (без скулта)2.zip
    2.8 KB · Просмотры: 17

dexer7

Пользователь
после установки, вместо сайта
Parse error: syntax error, unexpected ',' in C:\OpenServer\domains\**\library\includes\functions.php on line 2716
Если по очередности удалять case, ошибка перепрыгивает на следующие строки
Мод такой большой, тяжело с ним разобраться
Это:
PHP:
case 'post':
            $topic = ($data['type'] == 'post') ? '<a href="'. (POST_URL . $data['id'] .'#'. $data['id'], $old_title) .'" target="_blank">'. $title .'</a>' : '<a href="'. (TOPIC_URL . $data['id'], $old_title) .'" target="_blank">'. $title .'</a>';
            return 'Просмотр темы '. $topic;
        break;

        case 'forum':
            $forum = '<a href="'. (FORUM_URL . $data['id'], $old_title) .'" target="_blank">'. $title .'</a>';
            return 'Просмотр форума '. $forum;
        break;
заменить на:
PHP:
case 'post':
            $topic = ($data['type'] == 'post') ? '<a href="'. (POST_URL . $data['id'] .'#'. $data['id']) .'" target="_blank">'. $title .'</a>' : '<a href="'. (TOPIC_URL . $data['id']) .'" target="_blank">'. $title .'</a>';
            return 'Просмотр темы '. $topic;
        break;

        case 'forum':
            $forum = '<a href="'. (FORUM_URL . $data['id']) .'" target="_blank">'. $title .'</a>';
            return 'Просмотр форума '. $forum;
        break;
common.php
найти
PHP:
 case 'db_sqlite':
                        if (!isset($this->obj[$cache_name]))
                        {
                            $cache_cfg['pconnect']     = $this->cfg['pconnect'];
                            $cache_cfg['db_file_path'] = $this->get_db_path($cache_name, $cache_cfg, '.sqlite.db');
                            $cache_cfg['table_name']   = $cache_name;
                            $cache_cfg['table_schema'] = $this->get_table_schema($cache_cfg);

                            $this->obj[$cache_name] = new sqlite_common($cache_cfg);
                        }
                        $this->ref[$cache_name] =& $this->obj[$cache_name];
                        break;
заменить на
PHP:
case 'db_sqlite':
                        if (!isset($this->obj[$cache_name]))
                        {
                            $cache_cfg['pconnect']     = $this->cfg['pconnect'];
                            $cache_cfg['db_file_path'] = $this->get_db_path($cache_name, $cache_cfg, '.sqlite.db');
                            $cache_cfg['table_name']   = $cache_name;
                            $cache_cfg['table_schema'] = $this->get_table_schema($cache_cfg);
                            $cache_cfg['file_name']    = $cache_name.'.sqlite.db';
                            $cache_cfg['dir']             = $this->cfg['db_dir'];

                            $this->obj[$cache_name] = new sqlite_common($cache_cfg);
                        }
                        $this->ref[$cache_name] =& $this->obj[$cache_name];
                        break;
найти
PHP:
class sqlite_common extends cache_common
{
    var $cfg = array(
            'db_file_path' => 'sqlite.db',
            'table_name'   => 'table_name',
            'table_schema' => 'CREATE TABLE table_name (...)',
            'pconnect'     => true,
            'con_required' => true,
            'log_name'     => 'SQLite',
            'shard_type'   => 'none',     #  none, string, int (тип перевичного ключа для шардинга)
            'shard_val'    => 0,          #  для string - кол. начальных символов, для int - делитель (будет использован остаток от деления)
        );
    var $engine    = 'SQLite';
    var $dbh       = null;
    var $connected = false;
    var $shard_val = false;

    var $table_create_attempts = 0;

    function sqlite_common ($cfg)
    {
        $this->cfg = array_merge($this->cfg, $cfg);
        $this->dbg_enabled = sql_dbg_enabled();
    }

    function connect ()
    {
        $this->cur_query = ($this->dbg_enabled) ? ($this->cfg['pconnect'] ? 'p' : '') .'connect to: '. $this->cfg['db_file_path'] : 'connect';
        $this->debug('start');

        $connect_type = ($this->cfg['pconnect']) ? 'sqlite_popen' : 'sqlite_open';

        if ($this->cfg['shard_type'] != 'none' && $this->shard_val === false)
        {
            trigger_error("cannot shard: shard_val not defined for {$this->cfg['db_file_path']}", E_USER_ERROR);
        }

        if (@$this->dbh = $connect_type($this->cfg['db_file_path'], 0666, $sqlite_error))
        {
            $this->connected = true;
        }

        if (!$this->connected && $this->cfg['con_required'])
        {
            trigger_error($sqlite_error, E_USER_ERROR);
        }

        $this->debug('stop');
        $this->cur_query = null;
    }

    function create_table ()
    {
        $this->table_create_attempts++;
        return sqlite_query($this->dbh, $this->cfg['table_schema']);
    }

    function shard ($name)
    {
        $type = $this->cfg['shard_type'];

        if ($type == 'none') return;
        if (is_array($name))  trigger_error('cannot shard: $name is array', E_USER_ERROR);

        // define shard_val
        if ($type == 'string')
        {
            $shard_val = substr($name, 0, $this->cfg['shard_val']);
        }
        else
        {
            $shard_val = $name % $this->cfg['shard_val'];
        }
        // все запросы должны быть к одному и тому же шарду
        if ($this->shard_val !== false)
        {
            if ($shard_val != $this->shard_val)
            {
                trigger_error("shard cannot be reassigned. [{$this->shard_val}, $shard_val, $name]", E_USER_ERROR);
            }
            else
            {
                return;
            }
        }
        $this->shard_val = $shard_val;
        $this->cfg['db_file_path'] = str_replace('*', $shard_val, $this->cfg['db_file_path']);
    }

    function query ($query)
    {
        if (!$this->connected) $this->connect();

        $this->cur_query = $query;
        $this->debug('start');

        if (!$result = @sqlite_unbuffered_query($this->dbh, $query, SQLITE_ASSOC))
        {
            if (!$this->table_create_attempts && !sqlite_num_rows(sqlite_query($this->dbh, "PRAGMA table_info({$this->cfg['table_name']})")))
            {
                if ($this->create_table())
                {
                    $result = sqlite_unbuffered_query($this->dbh, $query, SQLITE_ASSOC);
                }
            }
            if (!$result)
            {
                $this->trigger_error($this->get_error_msg());
            }
        }

        $this->debug('stop');
        $this->cur_query = null;

        $this->num_queries++;

        return $result;
    }

    function fetch_row ($query)
    {
        $result = $this->query($query);
        return is_resource($result) ? sqlite_fetch_array($result, SQLITE_ASSOC) : false;
    }

    function fetch_rowset ($query)
    {
        $result = $this->query($query);
        return is_resource($result) ? sqlite_fetch_all($result, SQLITE_ASSOC) : array();
    }

    function changes ()
    {
        return is_resource($this->dbh) ? sqlite_changes($this->dbh) : 0;
    }

    function escape ($str)
    {
        return sqlite_escape_string($str);
    }

    function get_error_msg ()
    {
        return 'SQLite error #'. ($err_code = sqlite_last_error($this->dbh)) .': '. sqlite_error_string($err_code);
    }

    function rm ($name = '')
    {
        if ($name)
        {
            $this->db->shard($this->prefix . $name);
            $result = $this->db->query("DELETE FROM ". $this->cfg['table_name'] ." WHERE cache_name = '". sqlite_escape_string($this->prefix . $name) ."'");
        }
        else
        {
            $result = $this->db->query("DELETE FROM ". $this->cfg['table_name']);
        }
        return (bool) $result;
    }

    function gc ($expire_time = TIMENOW)
    {
        $result = $this->db->query("DELETE FROM ". $this->cfg['table_name'] ." WHERE cache_expire_time < $expire_time");
        return ($result) ? sqlite_changes($this->db->dbh) : 0;
    }

    function trigger_error ($msg = 'DB Error')
    {
        if (error_reporting()) trigger_error($msg, E_USER_ERROR);
    }
}
заменить на
PHP:
class sqlite_common extends cache_common
{
    var $cfg = array(
                 'db_file_path' => 'sqlite.db',
                 'table_name'   => 'table_name',
                 'table_schema' => 'CREATE TABLE table_name (...)',
                 'pconnect'     => true,
                 'con_required' => true,
                 'log_name'     => 'SQLite3',
                 'shard_type'   => 'none',     #  none, string, int (тип перевичного ключа для шардинга)
                 'shard_val'    => 0,          #  для string - кол. начальных символов, для int - делитель (будет использован остаток от деления)
                 'file_name'    => 'sqlite.db',
                 'dir'            => null,
               );
    var $engine    = 'SQLite3';
    var $dbh       = null;
    var $connected = false;
    var $shard_val = false;

    var $table_create_attempts = 0;

    function sqlite_common ($cfg)
    {
        $this->cfg = array_merge($this->cfg, $cfg);
        $this->dbg_enabled = sql_dbg_enabled();
    }

    function connect ()
    {
        $this->cur_query = ($this->dbg_enabled) ? ($this->cfg['pconnect'] ? 'p' : '') .'connect to: '. $this->cfg['db_file_path'] : 'connect';
        $this->debug('start');

        if ($this->cfg['shard_type'] != 'none' && $this->shard_val === false)
        {
            trigger_error("cannot shard: shard_val not defined for {$this->cfg['db_file_path']}", E_USER_ERROR);
        }
        $this->dbh = new SQLite3($this->cfg['db_file_path']);

        if ($this->dbh)
        {
            $this->connected = true;
        }
       
        if (!$this->connected && $this->cfg['con_required'])
        {
            trigger_error('Error', E_USER_ERROR);
        }

        $this->debug('stop');
        $this->cur_query = null;
    }

    function create_table ()
    {
        $this->table_create_attempts++;
        return $this->dbh->exec($this->cfg['table_schema']);
    }

    function shard ($name)
    {
        $type = $this->cfg['shard_type'];

        if ($type == 'none') return;
        if (is_array($name))  trigger_error('cannot shard: $name is array', E_USER_ERROR);

        // define shard_val
        if ($type == 'string')
        {
            $shard_val = substr($name, 0, $this->cfg['shard_val']);
        }
        else
        {
            $shard_val = $name % $this->cfg['shard_val'];
        }
        // все запросы должны быть к одному и тому же шарду
        if ($this->shard_val !== false)
        {
            if ($shard_val != $this->shard_val)
            {
                trigger_error("shard cannot be reassigned. [{$this->shard_val}, $shard_val, $name]", E_USER_ERROR);
            }
            else
            {
                return;
            }
        }
        $this->shard_val = $shard_val;
        $this->cfg['pconnect'] = str_replace('*', $shard_val, $this->cfg['db_file_path']);
    }

    function query ($query, $single = false)
    {
        if (!$this->connected) $this->connect();

        $this->cur_query = $query;
        $this->debug('start');
        $queryIns = ($single) ? 'querySingle':'query';
        $mode = ($single) ? @$this->dbh->$queryIns($query,true) : @$this->dbh->$queryIns($query);
        if (!$result = @$mode)
        {
            if (!$this->table_create_attempts && !$this->fetch_column_types($this->cfg['table_name']))
            {
                if ($this->create_table())
                {
                    $result = $this->dbh->exec($query);
                }
            }
        }
        $this->debug('stop');
        $this->cur_query = null;

        $this->num_queries++;

        return $result;
    }

    function fetch_row ($query)
    {
        $result = $this->query($query, true);
       
        return !empty($result) ? $result : false;
    }

    function fetch_rowset ($query)
    {
        $rows = array();
        $result = $this->query($query);
        $i = 0;
        while ($row = $result->fetchArray(SQLITE3_ASSOC)) {
            $rows[$i]=$row;
            $i++;
        }
       
        return !empty($result) ? $rows : array();
    }
       
    function changes ()
    {
        return ($this->dbh) ? $this->dbh->changes() : 0;
    }
   
    function prepare($row)
    {
        return ($this->dbh) ? $this->dbh->prepare($row) : 0;
    }
   
    function escape ($str)
    {
        return $this->dbh->escapeString($str);
    }

    function get_error_msg ()
    {
        return 'SQLite error #'. ($err_code = $this->dbh->lastErrorMsg()) .': '. $this->dbh->lastErrorCode();
    }

    function rm ($name = '')
    {
        if ($name)
        {
            $this->db->shard($this->prefix . $name);
            $result = $this->db->exec("DELETE FROM ". $this->cfg['table_name'] ." WHERE cache_name = '". $this->dbh->prepare($this->prefix . $name) ."'");
        }
        else
        {
            $result = $this->db->exec("DELETE FROM ". $this->cfg['table_name']);
        }
        return (bool) $result;
    }

    function gc ($expire_time = TIMENOW)
    {
        $result = $this->db->exec("DELETE FROM ". $this->cfg['table_name'] ." WHERE cache_expire_time < $expire_time");
        return ($result) ? $result->changes() : 0;
    }

    function trigger_error ($msg = 'DB Error')
    {
        if (error_reporting()) trigger_error($msg, E_USER_ERROR);
    }
   
    function fetch_column_types($table_name)
    {
        $col_types = array();
        $col_info_res  = $this->dbh->query( "PRAGMA table_info('". $table_name . "')");

        while ($col_info = $col_info_res->fetchArray(SQLITE3_ASSOC))
        {
            $column_name = $col_info['name'];
            $column_type = $col_info['type'];
            $col_types[$column_name] = $column_type;
        }
        $col_info_res->finalize();
        return $col_types;
    }
}
 

drew

Пользователь
Аддон, решил выложить, не помню, работает или нет.
после
<!-- IF IS_AM -->[ <a href="#" class="adm" onclick="ajax.mod_action('profile_ip'); return false;">{L_IP_ADDRESS}</a> ]<!-- ENDIF -->
Вставить
<!-- IF IS_AM -->[ <a href="#" class="adm" onclick="ajax.admin_data('where_user'); return false;">Логи</a> ]<!-- ENDIF -->
куда будешь выводить это
<!-- IF IS_ADMIN -->
<script type="text/javascript">

ajax.admin_data = function(mode) {
ajax.exec({action: 'admin_data', mode: mode, user_id: {PROFILE_USER_ID}});
}
ajax.callback.admin_data = function(data) {
$('#where_user_list').html(data.where_user_html);
$('#where_user_list1').show();
}

</script>
<table id="where_user_list1" class="mod_ip bCenter borderless" style="display:none" cellspacing="1">
<thead id="where_user_list"></thead>
</table>
<br />
<!-- ENDIF -->

создать файл admin_data.php

<?php

if (!defined('IN_AJAX')) die(basename(__FILE__));

global $bb_cfg, $lang, $userdata, $datastore;

$mode = (string) $this->request['mode'];
$html = '';

switch($mode)
{
case 'where_user':
$user_id = (int) $this->request['user_id'];

$row = CACHE('buf_where')->fetch_rowset("SELECT * FROM buf_where WHERE user_id = ".$user_id." ORDER BY time DESC LIMIT 10");

if ($row)
{
$html = '
<tr class="row3">
<th>Время</th>
<th>Отчет по действиям</th>
<th>Адрес IP</th>
</tr>';

foreach($row as $i => $row)
{
$row_class = (!($i % 2)) ? 'row1' : 'row2';
$where_user_url = str_short(where_user_url($row, false), 110);
$html .= '
<tr class="'.$row_class.' seedmed">
<td>'.bb_date($row['time']).'</td>
<td>'.$where_user_url.'</td>
<td>'.'<a href="'. $bb_cfg['whois_info'] . decode_ip($row['user_ip']) .'" target="_blank">'. decode_ip($row['user_ip']) .'</a>'.'</td>
</tr>';
}

$this->response['where_user_html'] = $html;
}
else
{
$this->response['where_user_html'] = '<tr><td>Никакой активности</td></tr>';
}
break;
}

$this->response['html'] = $html;
$this->response['mode'] = $mode;


Ajax.php

'admin_data' => array('admin'),

function admin_data()
{
require(AJAX_DIR .'admin_data.php');
}
 

Fantom 13

Пользователь
Virtuoz
Вот и не вьеду что куда!
Notice: crypt(): No salt parameter was specified. You must use a randomly generated salt and a strong hash function to produce a secure hash. in C:\WebServer\OpenServer\domains\Gigatracker.uz\common.php on line 309

Notice: Undefined property: sqlite_common::$db in C:\WebServer\OpenServer\domains\Gigatracker.uz\library\includes\cache\sqlite.php on line 280

Fatal error: Call to a member function query() on null in C:\WebServer\OpenServer\domains\Gigatracker.uz\library\includes\cache\sqlite.php on line 280

Notice: crypt(): No salt parameter was specified. You must use a randomly generated salt and a strong hash function to produce a secure hash. in C:\WebServer\OpenServer\domains\Gigatracker.uz\common.php on line 309
 
Сверху