Код: Выделить всё
##############################################################
## MOD Title: Hits Counter
## MOD Author: Vladson < dkfl@bk.ru > (N/A) http://www.dkflbk.nm.ru
## MOD Description: This mod gives you a forum statistics
## MOD Version: (1.0.0) [phpBB 2.0.6-2.0.10]
##
## Installation Level: Easy
## Installation Time: 5 Minutes
##
## Files To Edit (5): admin/admin_db_utilities.php
## includes/page_tail.php
## language/lang_english/lang_main.php
## templates/subSilver/overall_footer.tpl
## includes/constants.php
## Included Files: (n/a):
##############################################################
## For Security Purposes, Please Check: http://www.phpbb.com/mods/ for the
## latest version of this MOD. Downloading this MOD from other sites could cause malicious code
## to enter into your phpBB Forum. As such, phpBB will not offer support for MOD's not offered
## in our MOD-Database, located at: http://www.phpbb.com/mods/
##############################################################
## Author Notes:
##
##############################################################
## MOD History:
##
## 2004-10-27 - Version 1.0.0
## - First beta
##
##############################################################
## Before Adding This MOD To Your Forum, You Should Back Up All Files Related To This MOD
##############################################################
#
# --- [SQL] ---
#
CREATE TABLE `phpbb_counter` (
`hits_time` VARCHAR( 32 ) NOT NULL ,
`hits_ip` VARCHAR( 32 ) NOT NULL
);
#
# --- [OPEN] ---
#
admin/admin_db_utilities.php
#
# --- [FIND] ---
#
$tables = array('auth_access', 'banlist', 'categories', 'config', 'disallow', 'forums', 'forum_prune', 'groups', 'posts', 'posts_text', 'privmsgs', 'privmsgs_text', 'ranks', 'search_results', 'search_wordlist', 'search_wordmatch', 'sessions', 'smilies', 'themes', 'themes_name', 'topics', 'topics_watch', 'user_group', 'users', 'vote_desc', 'vote_results', 'vote_voters', 'words');
#
# --- [IN-LINE FIND] ---
#
'config',
#
# --- [IN-LINE AFTER ADD] ---
#
'counter',
#
# --- [OPEN] ---
#
includes/constants.php
#
# --- [FIND] ---
#
define('CONFIG_TABLE', $table_prefix.'config');
#
# --- [AFTER ADD] ---
#
define('COUNTER_TABLE', $table_prefix.'counter');
#
# --- [OPEN] ---
#
includes/page_tail.php
#
# --- [FIND] ---
#
if ( !defined('IN_PHPBB') )
{
die('Hacking attempt');
}
#
# --- [AFTER ADD] ---
#
//
// Counter
//
$sql = "INSERT INTO " . COUNTER_TABLE . " (hits_time, hits_ip) VALUES ('" . date('Yz') . "', '" . $user_ip . "')";
if ( !($result = $db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, 'Could not obtain hits information', '', __LINE__, __FILE__, $sql);
}
$sql = "SELECT COUNT(hits_time) as total FROM " . COUNTER_TABLE ;
$result = $db->sql_query($sql);
if( $result )
{
$row = $db->sql_fetchrow($result);
}
$hits_count = $row['total'];
$sql = "SELECT COUNT(hits_ip) as total FROM " . COUNTER_TABLE . " WHERE hits_time=" . date('Yz');
$result = $db->sql_query($sql);
if( $result )
{
$row = $db->sql_fetchrow($result);
}
$hits_today = $row['total'];
$sql = "SELECT COUNT(DISTINCT hits_ip) as hosts FROM " . COUNTER_TABLE . " WHERE hits_time=" . date('Yz') ;
$result = $db->sql_query($sql);
if( $result )
{
$row = $db->sql_fetchrow($result);
}
$hosts_today = $row['hosts'];
#
# --- [FIND] ---
#
$template->assign_vars(array(
#
# --- [AFTER ADD] ---
#
'HITS_COUNT' => $lang['Hits'] . "-" . $hits_count . " ",
'HITS_TODAY' => $lang['Today_Hits'] . "-" . $hits_today . " ",
'HOSTS_TODAY' => $lang['Today_Hosts'] . "-" . $hosts_today . " ",
#
# --- [OPEN] ---
#
language/lang_english/lang_main.php
#
# --- [FIND] ---
#
//
// That's all, Folks!
// -------------------------------------------------
#
# --- [BEFORE ADD] ---
#
// Counter
$lang['Hits'] = 'Hits';
$lang['Today_Hits'] = 'Today Hits';
$lang['Today_Hosts'] = 'Today Hosts';
#
# --- [OPEN] ---
#
templates/subSilver/overall_footer.tpl
#
# --- [FIND] ---
#
Powered by <a href="http://www.phpbb.com/" target="_phpbb" class="copyright">phpBB</a> {PHPBB_VERSION} © 2001, 2002 phpBB Group<br />{TRANSLATION_INFO}</span></div>
#
# --- [IN-LINE FIND] ---
#
{TRANSLATION_INFO}
#
# --- [IN-LINE AFTER ADD] ---
#
<br />{HITS_COUNT} // {HITS_TODAY} // {HOSTS_TODAY}
#
#-----[ SAVE/CLOSE ALL FILES ]------------------------------------------
#
# EoM