Page 1 of 1

Have a debugg, found problem but how to fix it ?

Posted: Tue Dec 12, 2006 8:23 pm
by Leon
As you can see here:
http://www.volunteerforum.se/website.php?id=64
Could not obtain user/day information

DEBUG MODE

SELECT user_id, username, user_allow_viewonline, user_level, user_session_time FROM phpbb_users WHERE user_id > 0 ORDER BY IF(user_level=1,3,user_level) DESC, username ASC

Line : 341
File : page_header.php



message_die() was called multiple times. This isn't supposed to happen. Was message_die() used in page_tail.php?

What has happened ? :?

Posted: Tue Dec 12, 2006 8:25 pm
by Leon
Line 350-352 in page_header.php:


{
message_die(GENERAL_ERROR, 'Could not obtain user/day information', '', __LINE__, __FILE__, $sql);
}

Posted: Tue Dec 12, 2006 8:32 pm
by Leon
Edited

Posted: Tue Dec 12, 2006 8:50 pm
by Leon
I found the problem but i don't know what to do to fix it because i
need that code:

It was the "Users of the day MOD" that caused it:

includes/page_header.php

Code: Select all

//
// Users of the day MOD
//

// ############ Edit below ############
// #
$display_not_day_userlist = 0;	// change to 1 here if you also want the list of the users who didn't visit to be displayed
$users_list_delay = 168;		// change here to the number of hours wanted for the list
// #
// ############ Edit above ############

$sql = "SELECT user_id, username, user_allow_viewonline, user_level, user_session_time
	FROM ".USERS_TABLE."
	WHERE user_id > 0
	ORDER BY IF(user_level=1,3,user_level) DESC, username ASC";
if( !($result = $db->sql_query($sql)) )
{
	message_die(GENERAL_ERROR, 'Could not obtain user/day information', '', __LINE__, __FILE__, $sql);
}

$day_userlist = '';
$day_users = 0;
$not_day_userlist = '';
$not_day_users = 0;

while( $row = $db->sql_fetchrow($result) )
{
	$style_color = '';
	if ( $row['user_level'] == ADMIN )
	{
		$row['username'] = '<b>' . $row['username'] . '</b>';
		$style_color = 'style="color:#' . $theme['fontcolor3'] . '"';
	}
	else if ( $row['user_level'] == MOD )
	{
		$row['username'] = '<b>' . $row['username'] . '</b>';
		$style_color = 'style="color:#' . $theme['fontcolor2'] . '"';
	}
	if ( $row['user_allow_viewonline'] )
	{
		$user_day_link = '<a href="' . append_sid("profile.$phpEx?mode=viewprofile&" . POST_USERS_URL . "=" . $row['user_id']) . '"' . $style_color .'>' . $row['username'] . '</a>';
	}
	else
	{
		$user_day_link = '<a href="' . append_sid("profile.$phpEx?mode=viewprofile&" . POST_USERS_URL . "=" . $row['user_id']) . '"' . $style_color .'><i>' . $row['username'] . '</i></a>';
	}
	if ( $row['user_allow_viewonline'] || $userdata['user_level'] == ADMIN )
	{
		if ( $row['user_session_time'] >= ( time() - $users_list_delay * 3600 ) )
		{
			$day_userlist .= ( $day_userlist != '' ) ? ', ' . $user_day_link : $user_day_link;
			$day_users++;
		}
		else
		{
			$not_day_userlist .= ( $not_day_userlist != '' ) ? ', ' . $user_day_link : $user_day_link;
			$not_day_users++;
		}
	}
}

$day_userlist = ( ( isset($forum_id) ) ? '' : sprintf($lang['Day_users'], $day_users, $users_list_delay) ) . ' ' . $day_userlist;

$not_day_userlist = ( ( isset($forum_id) ) ? '' : sprintf($lang['Not_day_users'], $not_day_users, $users_list_delay) ) . ' ' . $not_day_userlist;

if ( $display_not_day_userlist )
{
	$day_userlist .= '<br />' . $not_day_userlist;
}

//
// End of MOD
//

Posted: Wed Dec 13, 2006 3:03 am
by battye
I'm not genius with SQL, but try changing:

Code: Select all

 ORDER BY IF(user_level=1,3,user_level) DESC
To

Code: Select all

 ORDER BY user_level DESC

Posted: Wed Dec 13, 2006 6:21 pm
by Leon
Well then the Junior Admin made it cracked up...
You know i just changed back the:
website.php file to the original
(Without the header and footer now as before)

Seems like that was alot easier with all this problems. ](*,)

But i really loved it when that worked. But well time changes i suppose. :?