Code: Select all
<?php
define('IN_PHPBB', true);
$phpbb_root_path = './';
include($phpbb_root_path . 'extension.inc');
include($phpbb_root_path . 'common.'.$phpEx);
$userdata = session_pagestart($user_ip, PAGE_INDEX);
init_userprefs($userdata);
define('SHOW_ONLINE', true);
$page_title = $langї'Index'];
include($phpbb_root_path . 'includes/page_header.'.$phpEx);
$result = 0;
$query = "SELECT user_operation FROM phpbb_users WHERE user_id = $user_id";
$result = $db->sql_query($query);
if ($result == 1)
{
$template->set_filenames(array(
'body' => 'operations.tpl')
);
$template->pparse('body');
}
include($phpbb_root_path . 'includes/page_tail.'.$phpEx);
?>What I'm trying to do is make sure this person is authorized to load this page. As it stands in this code, result is never = 1. Even when the field I'm trying to get to is set to 1 in the database.
I'm guessing my problem is with the user id. I'm not that sure how to tell who the person is that is currently logged in. This is most likely the case if my problem is not with the query.
If someone could confirm that my code for the query looks alright I would appreciated it.