site history mod problem !
Verfasst: 31.08.2005 15:04
moin moin ich habe diesen mod
## Mod Title: Site History Mod
## Mod Version: 0.11.3 beta
## Author: Niels Chr. Rød Denmark < ncr@db9.dk > http://mods.db9.dk
versucht einzubaun, aber nachdem ich alle files oben hatte und verändert hatte ist die index.php nicht mehr ok gewesen !
kann sich evt jemand mal die inst anleitung ansehn, ob da ein problem drin ist ?
Edit : ich hab die lang_eng umgeschrieben, aber nicht in den ger ordner reingetan, kann ichd as dennoch tun ? quasi meine version von der lang_file einsetzen ?
thx
alex
## Mod Title: Site History Mod
## Mod Version: 0.11.3 beta
## Author: Niels Chr. Rød Denmark < ncr@db9.dk > http://mods.db9.dk
versucht einzubaun, aber nachdem ich alle files oben hatte und verändert hatte ist die index.php nicht mehr ok gewesen !
kann sich evt jemand mal die inst anleitung ansehn, ob da ein problem drin ist ?
Code: Alles auswählen
########################################################
## Mod Title: Site History Mod
## Mod Version: 0.11.3 beta
## Author: Niels Chr. Rød Denmark < ncr@db9.dk > http://mods.db9.dk
##
## Description: Stores the number of your sites vistitors into the db, so this info can be
## viewet in a statisics page
## you will be able to se how meny users was on your site a a given time, back in time
## statistics data is stored as accumulated date over a period of one day
## you will also be able to se how meny posts/topic those users made that time
## in total giving you an overview over when you users are visiting your site, and if they
## did only browse or in fact also made /delete posts
##
## Note, this mod, uses the forums time (hard coded) to deside when "today" is, this is nessesary since data is accumulative
##
## This mod is for phpBB2 ver 2.0.2
##
##
## Installation Level: Easy
## Installation Time: 2-3 Minutes
## Files To Edit: 2
## phpBB2/index.php
## phpBB2/includes/constants.php
## phpBB2/includes/functions_posts.php
## Included files 3
## phpBB2/site_hist.php
## phpBB2/language/langues_english/lang_siste_hist.php
## phpBB2/templates/subsilver/site_hist.tpl
##
##
## History:
## ver 0.9.0. - initial beta, stores users movement into DB
## ver 0.9.1. - corrected some typos in the how-to
## Now named Site History Mod
## ver 0.9.2. - corrected this part to work with prefix tabels
## ver 0.9.3. - now includes a view of the statistics
## ver 0.9.4. - now includes month,week and day statistics
## ver 0.9.5. - now improve the statistic mod, so who.is-online also show if users watch this
## ver 0.9.6. - updated the lang_statistcs2.php - thanks to THX|PK|, there was a few spelling mistakes
## ver 0.10.0. - now made independet of the original statistics mod, to improve the load speed of site_hist page
## ver 0.11.0. - now made it independed of the last visit mod, also stored data does follow the forums time
## ver 0.11.1. - fixed a [FIND] tag in the index.php
## ver 0.11.2. - included number of newly registerd users in the site history
## ver 0.11.3. - new version of site_hist.php
##
#################################################################
## Security Disclaimer: This MOD Cannot Be Posted To Or Added At Any Non-Official phpBB Sites
#################################################################
##
## Installation Notes:
## If you do not wan to do the ADD SQL your self, then I have provided
## a db_update.php, with will do the SQL stuff, simply run this instead
##
## in the index.php file, you should read this inserted code
## and replace the value with what ever timezone you prefere
##
## // change the number later in the next line, to what ever time zone your forum is located, this need to be hard coded
## // in the release of this mod, the number is 1
## $dato=create_date('H', $current_time,1);
##
## the timezone need also to be change in the site_hist.php
## define('SERVER_TIME_ZONE',1);
## the value 1, need to be set to what ever timezone you wish
########################################################
#
#-----[ ADD SQL ]------------------------------------------
#
# or run the included db_update.php file
CREATE TABLE site_history (date int (11) not null , reg mediumint(8) not null , hidden mediumint(8) not null , guests mediumint(8) not null , new_topics mediumint(8) not null , new_posts mediumint(8) not null , UNIQUE (date))
#
#-----[ OPEN ]------------------------------------------
#
includes/constants.php
#
#-----[ FIND ]------------------------------------------
#
define('VOTE_USERS_TABLE', $table_prefix.'vote_voters');
#
#-----[ AFTER, ADD ]------------------------------------------
#
define('SITE_HISTORY_TABLE', $table_prefix.'site_history');
#
#-----[ FIND ]------------------------------------------
#
define('PAGE_GROUPCP', -11);
#
#-----[ AFTER, ADD ]------------------------------------------
#
define('PAGE_SITE_HIST', -66);
#
#-----[ OPEN ]------------------------------------------
#
index.php
#
#-----[ FIND ]------------------------------------------
#
$is_auth_ary = auth(AUTH_VIEW, AUTH_LIST_ALL, $userdata, $forum_data);
#
#-----[ AFTE, ADD ]------------------------------------------
#
// added for site History mod
$current_time=time();
$minutes = date('is', $current_time);
$hour_now = $current_time - (60*($minutes[0].$minutes[1])) - ($minutes[2].$minutes[3]);
// change the number late in the next line, to what ever time zone your forum is located, this need to be hard coded
// in the release of this mod, the number is 1
$dato=create_date('H', $current_time,1);
$timetoday = $hour_now - (3600*$dato);
$sql = 'SELECT COUNT(DISTINCT session_ip) as guests_today FROM '.SESSIONS_TABLE.' WHERE session_user_id="'.ANONYMOUS.'" AND session_time >= '.$timetoday.' AND session_time< '.($timetoday+86399);
if (!$result = $db->sql_query($sql))
{
message_die(GENERAL_ERROR, "Couldn't retrieve guest user today data", "", __LINE__, __FILE__, $sql);
}
$guest_count = $db->sql_fetchrow ($result);
$sql = 'SELECT user_allow_viewonline, COUNT(*) as count FROM ' . USERS_TABLE . ' WHERE user_id!="'.ANONYMOUS.'" AND user_session_time >= '.$timetoday.' AND user_session_time< '.($timetoday+86399).' GROUP BY user_allow_viewonline';
if (!$result = $db->sql_query($sql))
{
message_die(GENERAL_ERROR, "Couldn't retrieve user today data", "", __LINE__, __FILE__, $sql);
}
while ($reg_count = $db->sql_fetchrow ($result))
{
if ($reg_count['user_allow_viewonline'])
{
$logged_visible_today=$reg_count['count'];
}
else
{
$logged_hidden_today=$reg_count['count'];
}
}
$db->sql_freeresult($result);
$sql='UPDATE '.SITE_HISTORY_TABLE.' SET reg="'.$logged_visible_today.'", hidden="'.$logged_hidden_today.'", guests=
"'.$guest_count['guests_today'].'" WHERE date='.$hour_now;
if ( !$db->sql_query($sql) || !$db->sql_affectedrows() )
{
$sql = 'INSERT IGNORE INTO '.SITE_HISTORY_TABLE.' (date, reg, hidden, guests)
VALUES ('.$hour_now.', "'.$logged_visible_today.'", "'.$logged_hidden_today.'", "'.$guest_count['guests_today'].'")';
if ( !($db->sql_query($sql)) )
{
message_die(CRITICAL_ERROR, 'Error create new site_hitory ', '', __LINE__, __FILE__, $sql);
}
}
if (isset($result))
{
$db->sql_freeresult($result);
}
#
#-----[ OPEN ]------------------------------------------
#
includes/functions_post.php
#
#-----[ FIND ]------------------------------------------
#
return;
}
//
// Delete a post/poll
#
#-----[ BEFORE, ADD ]------------------------------------------
#
$current_time=time();
$minutes = date('is', $current_time);
$hour_now = $current_time - (60*($minutes[0].$minutes[1])) - ($minutes[2].$minutes[3]);
$sql='UPDATE '.SITE_HISTORY_TABLE.' SET '.(($mode == 'newtopic' || $post_data['first_post']) ? 'new_topics=new_topics':'new_posts=new_posts').$sign.' WHERE date='.$hour_now;
if ( !$db->sql_query($sql) || !$db->sql_affectedrows() )
{
$sql = 'INSERT IGNORE INTO '.SITE_HISTORY_TABLE. ' (date, '.(($mode == 'newtopic' || $post_data['first_post']) ? 'new_topics': 'new_posts').')
VALUES ('.$hour_now.', "1")';
if ( !($db->sql_query($sql)) )
{
message_die(CRITICAL_ERROR, 'Error createing new site_hitory'.$sql, '', __LINE__, __FILE__, $sql);
}
}
#
#-----[ MAKE FILE ]------------------------------------------
#
# Included.
site_hist.php
#
#-----[ MAKE FILE ]------------------------------------------
#
# Included.
language/english/lang_site_hist.php
#
#-----[ MAKE FILE ]------------------------------------------
#
# Included.
templates/subsilver/site_hist.tplEdit : ich hab die lang_eng umgeschrieben, aber nicht in den ger ordner reingetan, kann ichd as dennoch tun ? quasi meine version von der lang_file einsetzen ?
thx
alex