[erledigt] Wer war da - MOD mysql fehler
Verfasst: 24.03.2008 20:48
moin zusammen,
hab den "Wer war da - MOD 1.9.4 - modified by Kubi" eingebaut - funktioniert auch alles wunderbar, d.h. er zählt die user + gäste, resetet um 0uhr etc.
allerdings bekomm ich folgende fehlermeldung wenn ich mich aus dem forum auslogge:
line 35-204
benutze die version 2.0.23
thx schon mal im voraus
gruss iro
hab den "Wer war da - MOD 1.9.4 - modified by Kubi" eingebaut - funktioniert auch alles wunderbar, d.h. er zählt die user + gäste, resetet um 0uhr etc.
allerdings bekomm ich folgende fehlermeldung wenn ich mich aus dem forum auslogge:
hier der entsprechende code für den mod aus der index.php.Allgemeiner Fehler
Could not delete your ip from PREFIX_wwd_counter_ips table
DEBUG MODE
SQL Error : 1062 Doppelter Eintrag '71.115.9' für Schlüssel 1
INSERT INTO `phpbb_wwd_counter_ips` (ip) VALUES ('71.115.98.XX')
Line : 75
File : index.php
Code: Alles auswählen
//
// BEGIN Wer_war_da_MOD
//
// Start Settings
$enable_wwd_counter = True; //Enables or disables counting of hidden users and guests. Values: True or False
// End Settings
$time = time();
$heute = date('Ymd', $time);
$ip = $_SERVER['REMOTE_ADDR'];
$mitternacht = mktime(0,0,0,date('m', $time),date('d', $time),date('Y', $time));
$user_gmd = ( $userdata['session_logged_in'] ) ? $userdata['user_timezone'] : $board_config['board_timezone'];
if ( $enable_wwd_counter ) {
if ( $board_config['wwd_counter_date'] != $heute ){
$sql = "UPDATE " . CONFIG_TABLE . "
SET config_value = '$heute'
WHERE config_name = 'wwd_counter_date'";
if ( !$db->sql_query($sql) )
{
message_die(GENERAL_ERROR, 'Could not update CONFIG_TABLE wwd_counter_date', '', __LINE__, __FILE__, $sql);
}
$sql = "DELETE FROM `" . $table_prefix . "wwd_counter_ips`";
if ( !$db->sql_query($sql) )
{
message_die(GENERAL_ERROR, 'Could not delete ips from PREFIX_wwd_counter_ips table', '', __LINE__, __FILE__, $sql);
}
}
$sql = "DELETE FROM `" . $table_prefix . "wwd_counter_ips`
WHERE `ip` = '$ip'";
if ( !$db->sql_query($sql) )
{
message_die(GENERAL_ERROR, 'Could not delete your ip from PREFIX_wwd_counter_ips table', '', __LINE__, __FILE__, $sql);
}
if ( $userdata['session_logged_in'] ) {
} else {
$sql = "INSERT INTO `" . $table_prefix . "wwd_counter_ips`
(ip) VALUES ('$ip')";
if ( !$db->sql_query($sql) )
{
message_die(GENERAL_ERROR, 'Could not delete your ip from PREFIX_wwd_counter_ips table', '', __LINE__, __FILE__, $sql);
}
}
}
if ( $userdata['user_level'] != ADMIN )
{
$sql_add2 = "AND user_allow_viewonline = '1'";
}
$sql = "SELECT user_id, username, user_session_time, user_level, user_allow_viewonline
FROM " . USERS_TABLE . "
WHERE user_session_time > $mitternacht $sql_add2
ORDER BY user_session_time DESC";
$result = $db->sql_query($sql);
while( $row = $db->sql_fetchrow($result) )
{
//
// Änderung von Kubi, daß die Liste nur eingeloggten Benutzern oder Administratoren angezeigt wird.
// Nur eine der folgenden beiden Zeilen darf ohne '//' stehen
//
// if ( $userdata['user_level'] == ADMIN )
if( $userdata['session_logged_in'] )
{
$user_today .= ($count_user_today > 0) ? ', ' : '';
if ( $row['user_allow_viewonline'] == 0 )
{
$user_today .= '<i>';
}
$user_today .= '<a href="' . append_sid('profile.php?mode=viewprofile&u=' . $row['user_id']) . '"';
if ( $row['user_level'] == ADMIN )
{
$user_today .= ' style="color: #' . $theme['fontcolor3'].'"><b>' . $row['username'].'</b></a>';
}
elseif ( $row['user_level'] == MOD )
{
$user_today .= ' style="color: #' . $theme['fontcolor2'].'"><b>' . $row['username'].'</b></a>';
}
else
{
$user_today .= '>' . $row['username'] . '</a>';
}
$user_today .= ' (' . $lang['wwd_last'] . ' ' . create_date('H:i', $row['user_session_time'], $user_gmd) . ')';
if ( $row['user_allow_viewonline'] == 0 )
{
$user_today .= '</i>';
$hidden++;
}
}
$count_user_today++;
}
if ( $count_user_today > $board_config['wwd_record_users'] )
{
$sql = 'UPDATE ' . CONFIG_TABLE . " SET config_value = '$count_user_today' WHERE config_name = 'wwd_record_users'";
if ( !$db->sql_query($sql) )
{
message_die(GENERAL_ERROR, 'Could not update row wwd_record_users in phpBB CONFIG_TABLE', '', __LINE__, __FILE__, $sql);
}
$sql = "UPDATE " . CONFIG_TABLE . " SET config_value = '$time' WHERE config_name = 'wwd_record_time'";
if ( !$db->sql_query($sql) )
{
message_die(GENERAL_ERROR, 'Could not update row wwd_record_time in phpBB CONFIG_TABLE', '', __LINE__, __FILE__, $sql);
}
$record_users = $count_user_today;
$record_time = $time;
} else {
$record_users = $board_config['wwd_record_users'];
$record_time = $board_config['wwd_record_time'];
}
$record_text = str_replace('%u', $record_users, $lang['wwd_record']);
$record_text = str_replace('%t', create_date($lang['DATE_FORMAT'], $record_time, $user_gmd), $record_text);
$total_users = $count_user_today;
$count_user_today -=$hidden;
if ( $enable_wwd_counter ) {
$sql = 'SELECT `ip` FROM `' . $table_prefix . 'wwd_counter_ips`';
$result = $db->sql_query($sql);
if ( !$result )
{
message_die(GENERAL_ERROR, 'Could not read number of guests from PREFIX_wwd_counter_ips', '', __LINE__, __FILE__, $sql);
}
$gaeste = $db->sql_numrows($result);
$total_users += $gaeste;
}
if ( $enable_wwd_counter ) {
$user_today_text .= ( $total_users > 1 ) ? str_replace('%d', $total_users, $lang['wwd_c_user_today']) : $lang['wwd_c_one_user'];
$user_today_text .= ( $count_user_today == 0 || $count_user_today == '' ) ? $lang['Reg_users_zero_total'] : '';
$user_today_text .= ( $count_user_today == 1 ) ? str_replace('%d', $count_user_today, $lang['Reg_user_total']) : '';
$user_today_text .= ( $count_user_today > 1 ) ? str_replace('%d', $count_user_today, $lang['Reg_users_total']) : '';
$user_today_text .= ( $hidden == 0 || $hidden == '' ) ? $lang['Hidden_users_zero_total'] : '';
$user_today_text .= ( $hidden == 1 ) ? str_replace('%d', $hidden, $lang['Hidden_user_total']) : '';
$user_today_text .= ( $hidden > 1 ) ? str_replace('%d', $hidden, $lang['Hidden_users_total']) : '';
$user_today_text .= ( $gaeste == 0 || $gaeste == '' ) ? $lang['Guest_users_zero_total'] : '';
$user_today_text .= ( $gaeste == 1 ) ? str_replace('%d', $gaeste, $lang['Guest_user_total']) : '';
$user_today_text .= ( $gaeste > 1 ) ? str_replace('%d', $gaeste, $lang['Guest_users_total']) : '';
} else {
if ( $count_user_today > 1 ) {
$user_today_text = str_replace('%u', $count_user_today, $lang['wwd_user_today']);
} elseif ( $count_user_today == 1 ) {
$user_today_text = $lang['wwd_one_user'];
} else {
$user_today_text = $lang['wwd_no_user'];
}
}
$db->sql_freeresult($result);
//
// END Wer_war_da_MOD
//
benutze die version 2.0.23
thx schon mal im voraus

gruss iro