Seite 2 von 2

Verfasst: 18.06.2007 14:50
von wwwthomasbauerattf
ja genau

zB möchte ich wissen wer im April 2006 die meisten Posts geschreiben hat (also von 1.4.2006 - 30.4.2006)

und die bisherige statistik zeigt ja nur die am häufigsten Benutzer des AKTUELLEN Monats an...

deshalb denke ich, wenn man da ein wenig an dem code ändert muss es möglich sein, das man auch die topposter der vergangen monate rausbekommt.

Verfasst: 31.08.2007 14:24
von wwwthomasbauerattf
weiß keiner eine möglichkeit?
muss doch irgendwie realisierar sein...

bitte bitte bitte

Verfasst: 31.08.2007 14:47
von Seimon
SQL-ABfrage:

Code: Alles auswählen

SELECT u.user_id, u.username, count( u.user_id ) AS user_posts
FROM forum_users u, forum_posts p
WHERE (
u.user_id = p.poster_id
)
AND (
p.post_time >1143849600
)
AND (
p.post_time <1146441600
)
AND (
u.user_id <> -1
)
GROUP BY user_id, username
ORDER BY user_posts DESC 
LIMIT 5 
Die post time hab ich von hier:
http://www.onlineconversion.com/unix_time.htm
1143849600 : 1.4.2006, 00:00
1146441600 : 1.5.2006, 00:00

Verfasst: 31.08.2007 16:41
von wwwthomasbauerattf
jipiiie. das hat ja tatsächlich geklappt

voll supa...

ganz ganz großes dankeschön...

Verfasst: 15.05.2008 12:43
von wwwthomasbauerattf
@Seimon

habe einen neuen statistik-mod und da ist tas top_posters_month module anders:

Code: Alles auswählen

<?php
/***************************************************************************
*                            top_posters_month.pak
*                            --------------------
*     begin                :
*     copyright            : (C)      Wicher
*     email                : ---
*
*     $Id: top_posters_month.pak, 2006/11/14 16:06:00 Wicher Exp $
*          for Statistics MOD version 3.0.1beta3s and higher
****************************************************************************/
/***************************************************************************
*
*   This program is free software; you can redistribute it and/or modify
*   it under the terms of the GNU General Public License as published by
*   the Free Software Foundation; either version 2 of the License, or
*   (at your option) any later version.
*
****************************************************************************/

if ( !defined('IN_PHPBB') )
{
	die("Hacking attempt");
}

//
// Top Posting Users this Month

$core->start_module(true);

$core->set_content('bars');

$core->set_view('rows', $core->return_limit);
$core->set_view('columns', 5);

$core->define_view('set_columns', array(
	$core->pre_defined('rank'),
	'username' => $lang['Username'],
	'posts' => $lang['Posts'],
	$core->pre_defined('percent'),
	$core->pre_defined('graph'))
);

$content->percentage_sign = TRUE;

$month = array();
$current_time = 0;

$current_time = time();
$year = date('Y', $current_time);
$month [0] = mktime (0,0,0,1,1, $year);
$month [1] = $month [0] + 2678400;
$month [2] = mktime (0,0,0,3,1, $year);
$month [3] = $month [2] + 2678400;
$month [4] = $month [3] + 2592000;
$month [5] = $month [4] + 2678400;
$month [6] = $month [5] + 2592000;
$month [7] = $month [6] + 2678400;
$month [8] = $month [7] + 2678400;
$month [9] = $month [8] + 2592000;
$month [10] = $month [9] + 2678400;
$month [11] = $month [10] + 2592000;
$month [12] = $month [11] + 2592000;
$arr_num = (date('n')-1);
$time_thismonth = $month[$arr_num];

$l_this_month = date('F', $time_thismonth);

$core->set_header($lang['module_name'] . ' [' . $l_this_month . ' ' . date('Y', $time_thismonth) . ']');

$core->assign_defined_view('align_rows', array(
	'left',
	'left',
	'center',
	'center',
	'left')
);

$sql = "SELECT u.user_id, u.username, count(u.user_id) as user_posts  
FROM " . USERS_TABLE . " u, " . POSTS_TABLE . " p 
WHERE (u.user_id = p.poster_id) AND (p.post_time > '" . intval($time_thismonth) . "') AND (u.user_id <> " . ANONYMOUS . ")
GROUP BY u.user_id, u.username
ORDER BY user_posts DESC
LIMIT " . $core->return_limit; 

$result = $core->sql_query($sql, 'Unable to retrieve users data');

$total_posts_thismonth = 0;
$user_count = $core->sql_numrows($result);
$user_data = $core->sql_fetchrowset($result);

for ($i = 0; $i < $user_count; $i++)
{
	$total_posts_thismonth += $user_data[$i]['user_posts'];
}

$content->init_math('user_posts', $user_data[0]['user_posts'], $total_posts_thismonth);
$core->set_data($user_data);

$core->define_view('set_rows', array(
	'$core->pre_defined()',
	'$core->generate_link(append_sid($phpbb_root_path . \'profile.php?mode=viewprofile&u=\' . $core->data(\'user_id\')), $core->data(\'username\'), \'target="_blank"\')',
	'$core->data(\'user_posts\')',
	'$core->pre_defined()',
	'$core->pre_defined()')
);

$core->run_module();

?>
wenn ich jetzt deinen code mit dem vorhanden übersetzte kommt eine fehlermeldung... was muss ich ändern?

momentan kommt dann auf statistics.php die meldung:

Parse error: syntax error, unexpected T_STRING in /usr/export/www/vhosts/funnetwork/hosting/bauerthomas/Forum/modules/top_posters_month/module.php on line 80

zeile 80 ist eben die erste von deinem code:

Code: Alles auswählen

SELECT u.user_id, u.username, count( u.user_id ) AS user_posts 
FROM forum_users u, forum_posts p 
WHERE ( 
u.user_id = p.poster_id 
) 
AND ( 
p.post_time >1143849600 
) 
AND ( 
p.post_time <1146441600 
) 
AND ( 
u.user_id <> -1 
) 
GROUP BY user_id, username 
ORDER BY user_posts DESC 
LIMIT 5

Verfasst: 21.05.2008 14:39
von wwwthomasbauerattf
ich habe diese zeile:

Code: Alles auswählen

WHERE (u.user_id = p.poster_id) AND (p.post_time > '" . intval($time_thismonth) . "') AND (u.user_id <> " . ANONYMOUS . ") 
so geändert:

Code: Alles auswählen

WHERE (u.user_id = p.poster_id) AND (p.post_time > 1207008000) AND (p.post_time < 1209599999) AND (u.user_id <> -1 )
passt jetzt eh