Error SQL Blank Template MOD

This forum is now closed as part of retiring phpBB2
Forum rules
READ: phpBB.com Board-Wide Rules and Regulations

This forum is now closed due to phpBB2.0 being retired.
Locked
User avatar
pcast
Registered User
Posts: 257
Joined: Sun Jul 25, 2004 11:54 pm
Location: France
Contact:

Error SQL Blank Template MOD

Post by pcast » Wed Nov 10, 2004 12:26 am

Hello,

I have an error which occurs from time to time and I do not find what causes it. This error occurs that on my host but not in localhost.

Please, could you help me ?

Thank you.
Could not obtain regd user/online information

DEBUGG

Error SQL: 1064 'WHERE page_id = 2928' line 1

Request SQL:
SELECT forum_name, forum_id FROM phpbb_forums


Line: 431
File: /home/user/s/k/y/sky/www/fra/phpBB2/admin/index.php


Error Code:
Line-421: // BEGIN Blank Template MOD
Line-422:
Line-423: if( $onlinerow_reg[$i]['user_session_page'] < PAGE_TEMPLATE )
Line-424: {
Line-425: $page_id = - ($onlinerow_reg[$i]['user_session_page'] + PAGE_TEMPLATE);
Line-426: $sql_tpl = "SELECT page_name WHERE page_id = $page_id";
Line-427:
Line-428: if ( !($result_tpl = $db->sql_query($sql_tpl)) )
Line-429: {
Line-430: message_die(GENERAL_ERROR, 'Could not obtain regd user/online information', '', __LINE__, __FILE__, $sql);
Line-431: }

baerenwurm
Registered User
Posts: 131
Joined: Wed Nov 06, 2002 2:38 pm
Location: Germany

Post by baerenwurm » Sun Sep 24, 2006 3:17 pm

I have a similar error; the MOD's name is Blank Template MOD 2.0.0:

Code: Select all

Could not obtain regd user/online information

DEBUG MODE

SQL Error : 1064 You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near 'WHERE page_id = 2355' at line 1

SELECT u.user_id, u.username, u.user_allow_viewonline, u.user_level, s.session_logged_in, s.session_time, s.session_page, s.session_ip FROM phpbb_users u, phpbb_sessions s WHERE u.user_id = s.session_user_id AND s.session_time >= 1159111293 ORDER BY u.username ASC, s.session_ip ASC

Line : 343
File : viewonline.php
If I remove the following lines from viewonline.php it works:

Code: Select all

      // BEGIN Blank Template MOD

      if( $row['session_page'] < PAGE_TEMPLATE )

      {

        $page_id = - ($row['session_page'] + PAGE_TEMPLATE);

        $sql_tpl = "SELECT page_name WHERE page_id = $page_id";

        if ( !($result_tpl = $db->sql_query($sql_tpl)) )

        {

	  message_die(GENERAL_ERROR, 'Could not obtain regd user/online information', '', __LINE__, __FILE__, $sql);

        }

        while( $rowtpl = $db->sql_fetchrow($result_tpl) )

        {

          $location = $rowtpl['page_name'];

	  $location_url = "template.$phpEx?page=$page_id";

	}	

      }

      // END Blank Template MOD
Any ideas?

[e] It might have something to do with the Last Visit Mod

This is my viewonline.php:

Code: Select all

<?php

/***************************************************************************

 *                              viewonline.php

 *                            -------------------

 *   begin                : Saturday, Feb 13, 2001

 *   copyright            : (C) 2001 The phpBB Group

 *   email                : support@phpbb.com

 *

 *   $Id: viewonline.php,v 1.54.2.4 2005/05/06 20:50:10 acydburn Exp $

 *

 *

 ***************************************************************************/



/***************************************************************************

 *

 *   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.

 *

 ***************************************************************************/



define("_BBC_PAGE_NAME", "viewonline.php");

define("_BBCLONE_DIR", "stats/");

define("COUNTER", _BBCLONE_DIR."mark_page.php");

if (is_readable(COUNTER)) include_once(COUNTER);



define('IN_PHPBB', true);

$phpbb_root_path = './';

include($phpbb_root_path . 'extension.inc');

include($phpbb_root_path . 'common.'.$phpEx);



//

// Start session management

//

$userdata = session_pagestart($user_ip, PAGE_VIEWONLINE);

init_userprefs($userdata);

//

// End session management

//



//

// Output page header and load viewonline template

//

$page_title = $lang['Who_is_Online'];

include($phpbb_root_path . 'includes/page_header.'.$phpEx);



$template->set_filenames(array(

	'body' => 'viewonline_body.tpl')

);

make_jumpbox('viewforum.'.$phpEx);



$template->assign_vars(array(

	'L_WHOSONLINE' => $lang['Who_is_Online'],

	'L_ONLINE_EXPLAIN' => $lang['Online_explain'],

	'L_USERNAME' => $lang['Username'],

	'L_FORUM_LOCATION' => $lang['Forum_Location'],

	'L_LAST_UPDATE' => $lang['Last_updated'])

);



//

// Forum info

//

$sql = "SELECT forum_name, forum_id

	FROM " . FORUMS_TABLE;

if ( $result = $db->sql_query($sql) )

{

	while( $row = $db->sql_fetchrow($result) )

	{

		$forum_data[$row['forum_id']] = $row['forum_name'];

	}

}

else

{

	message_die(GENERAL_ERROR, 'Could not obtain user/online forums information', '', __LINE__, __FILE__, $sql);

}



//

// Get auth data

//

$is_auth_ary = array();

$is_auth_ary = auth(AUTH_VIEW, AUTH_LIST_ALL, $userdata);



//

// Get user list

//

$sql = "SELECT u.user_id, u.username, u.user_allow_viewonline, u.user_level, s.session_logged_in, s.session_time, s.session_page, s.session_ip

	FROM ".USERS_TABLE." u, ".SESSIONS_TABLE." s

	WHERE u.user_id = s.session_user_id

		AND s.session_time >= ".( time() - 300 ) . "

	ORDER BY u.username ASC, s.session_ip ASC";

if ( !($result = $db->sql_query($sql)) )

{

	message_die(GENERAL_ERROR, 'Could not obtain regd user/online information', '', __LINE__, __FILE__, $sql);

}



$guest_users = 0;

$registered_users = 0;

$hidden_users = 0;

$reg_counter = 0;

$guest_counter = 0;

$prev_user = 0;

$prev_ip = '';



while ( $row = $db->sql_fetchrow($result) )

{

	$view_online = false;



	if ( $row['session_logged_in'] ) 

	{

		$user_id = $row['user_id'];



		if ( $user_id != $prev_user )

		{

			$username = $row['username'];



			$style_color = '';

			if ( $row['user_level'] == ADMIN )

			{

				$username = '<b style="color:#' . $theme['fontcolor3'] . '">' . $username . '</b>';

			}

			else if ( $row['user_level'] == MOD )

			{

				$username = '<b style="color:#' . $theme['fontcolor2'] . '">' . $username . '</b>';

			}



			if ( !$row['user_allow_viewonline'] )

			{

				$view_online = ( $userdata['user_level'] == ADMIN ) ? true : false;

				$hidden_users++;



				$username = '<i>' . $username . '</i>';

			}

			else

			{

				$view_online = true;

				$registered_users++;

			}



			$which_counter = 'reg_counter';

			$which_row = 'reg_user_row';

			$prev_user = $user_id;

		}

	}

	else

	{

		if ( $row['session_ip'] != $prev_ip )

		{

			$username = $lang['Guest'];

			$view_online = true;

			$guest_users++;

	

			$which_counter = 'guest_counter';

			$which_row = 'guest_user_row';

		}

	}



	$prev_ip = $row['session_ip'];



	if ( $view_online )

	{

		if ( $row['session_page'] < 1 || !$is_auth_ary[$row['session_page']]['auth_view'] )

		{



      // BEGIN Blank Template MOD

      if( $row['session_page'] < PAGE_TEMPLATE )

      {

        $page_id = - ($row['session_page'] + PAGE_TEMPLATE);

        $sql_tpl = "SELECT page_name WHERE page_id = $page_id";

        if ( !($result_tpl = $db->sql_query($sql_tpl)) )

        {

	  message_die(GENERAL_ERROR, 'Could not obtain regd user/online information', '', __LINE__, __FILE__, $sql);

        }

        while( $rowtpl = $db->sql_fetchrow($result_tpl) )

        {

          $location = $rowtpl['page_name'];

	  $location_url = "template.$phpEx?page=$page_id";

	}	

      }

      // END Blank Template MOD



			switch( $row['session_page'] )

			{

				case PAGE_INDEX:

					$location = $lang['Forum_index'];

					$location_url = "index.$phpEx";

					break;

				case PAGE_POSTING:

					$location = $lang['Posting_message'];

					$location_url = "index.$phpEx";

					break;

				case PAGE_LOGIN:

					$location = $lang['Logging_on'];

					$location_url = "index.$phpEx";

					break;

				case PAGE_SEARCH:

					$location = $lang['Searching_forums'];

					$location_url = "search.$phpEx";

					break;

				case PAGE_PROFILE:

					$location = $lang['Viewing_profile'];

					$location_url = "index.$phpEx";

					break;

				case PAGE_VIEWONLINE:

					$location = $lang['Viewing_online'];

					$location_url = "viewonline.$phpEx";

					break;

				case PAGE_VIEWMEMBERS:

					$location = $lang['Viewing_member_list'];

					$location_url = "memberlist.$phpEx";

					break;

				case PAGE_PRIVMSGS:

					$location = $lang['Viewing_priv_msgs'];

					$location_url = "privmsg.$phpEx";

					break;

				case PAGE_FAQ:

					$location = $lang['Viewing_FAQ'];

					$location_url = "faq.$phpEx";

					break;

				case PAGE_ACTIVITY:

					$location = $lang['Activity'];

					$location_url = "activity.$phpEx";

					break;

				case PAGE_RECENT:

					$location = $lang['Recent_topics'];

					$location_url = "recent.$phpEx";

					break;

				default:

					$location = $lang['Forum_index'];

					$location_url = "index.$phpEx";

			}

		}

		else

		{

//-- mod : seo urls v2 ---------------------------------------------------------
//-- add
			$forum_name = $forum_data[$row['session_page']];
//-- fin mod : seo urls v2 -----------------------------------------------------

			$location_url = append_sid("viewforum.$phpEx?" . POST_FORUM_URL . '=' . $row['session_page']);

			$location = $forum_data[$row['session_page']];

		}



		$row_color = ( $$which_counter % 2 ) ? $theme['td_color1'] : $theme['td_color2'];

		$row_class = ( $$which_counter % 2 ) ? $theme['td_class1'] : $theme['td_class2'];



		$template->assign_block_vars("$which_row", array(

			'ROW_COLOR' => '#' . $row_color,

			'ROW_CLASS' => $row_class,

			'USERNAME' => $username,

			'LASTUPDATE' => create_date($board_config['default_dateformat'], $row['session_time'], $board_config['board_timezone']),

			'FORUM_LOCATION' => $location,



			'U_USER_PROFILE' => append_sid("profile.$phpEx?mode=viewprofile&" . POST_USERS_URL . '=' . $user_id),

			'U_FORUM_LOCATION' => append_sid($location_url))

		);



		$$which_counter++;

	}

}



if( $registered_users == 0 )

{

	$l_r_user_s = $lang['Reg_users_zero_online'];

}

else if( $registered_users == 1 )

{

	$l_r_user_s = $lang['Reg_user_online'];

}

else

{

	$l_r_user_s = $lang['Reg_users_online'];

}



if( $hidden_users == 0 )

{

	$l_h_user_s = $lang['Hidden_users_zero_online'];

}

else if( $hidden_users == 1 )

{

	$l_h_user_s = $lang['Hidden_user_online'];

}

else

{

	$l_h_user_s = $lang['Hidden_users_online'];

}



if( $guest_users == 0 )

{

	$l_g_user_s = $lang['Guest_users_zero_online'];

}

else if( $guest_users == 1 )

{

	$l_g_user_s = $lang['Guest_user_online'];

}

else

{

	$l_g_user_s = $lang['Guest_users_online'];

}


$template->assign_vars(array(

	'TOTAL_REGISTERED_USERS_ONLINE' => sprintf($l_r_user_s, $registered_users) . sprintf($l_h_user_s, $hidden_users), 

	'TOTAL_GUEST_USERS_ONLINE' => sprintf($l_g_user_s, $guest_users))

);



if ( $registered_users + $hidden_users == 0 )

{

	$template->assign_vars(array(

		'L_NO_REGISTERED_USERS_BROWSING' => $lang['No_users_browsing'])

	);

}



if ( $guest_users == 0 )

{

	$template->assign_vars(array(

		'L_NO_GUESTS_BROWSING' => $lang['No_users_browsing'])

	);

}



$template->pparse('body');



include($phpbb_root_path . 'includes/page_tail.'.$phpEx);



?>

User avatar
Jim_UK
Former Team Member
Posts: 18478
Joined: Tue Oct 12, 2004 5:36 pm
Location: Darwen N.West UK

Post by Jim_UK » Sun Sep 24, 2006 5:18 pm

Support for mod related problems is within the release thread for that mod. In this case it is here http://www.phpbb.com/phpBB/viewtopic.php?t=142506

This is locked.

Jim
The truth is out there.
Unfortunately they will not let you anywhere near it!

Locked

Return to “[2.0.x] MOD Requests”