Hi, I have phpbb and coppermine integrated. For my other pages I make this code (the code at bottom) to load my custom header that I make. That header have login box for my forums and when the user is logged in, it have links to profile and logout. I want my gallery to have the same header, but the template.html can't load php. I try to make header.php file with my header code and load it from admin menu, but then it show's me errors. Here is my header.php code:
<?php
define('IN_PHPBB', true);
$phpbb_root_path = '../forums/';
include($phpbb_root_path . 'extension.inc');
include($phpbb_root_path . 'common.'.$phpEx);
//
// Start session management
//
$userdata = session_pagestart($user_ip, PAGE_INDEX);
init_userprefs($userdata);
//
// End session management
//
if( $userdata['session_logged_in'] )
{
// they're logged in, welcome them, check to see if they're admin, grab their info
{
$u_login_logout = 'forums/login.'.$phpEx.'?logout=true&sid=' . $userdata['session_id'];
$l_login_logout = $lang['Logout'] . ' [ ' . $userdata['username'] . ' ]';
}
if ( ($userdata['session_logged_in']) && (empty($gen_simple_header)) )
{
if ( $userdata['user_new_privmsg'] )
{
$l_message_new = ( $userdata['user_new_privmsg'] == 1 ) ? $lang['New_pm'] : $lang['New_pms'];
$l_privmsgs_text = sprintf($l_message_new, $userdata['user_new_privmsg']);
if ( $userdata['user_last_privmsg'] > $userdata['user_lastvisit'] )
{
$sql = "UPDATE " . USERS_TABLE . "
SET user_last_privmsg = " . $userdata['user_lastvisit'] . "
WHERE user_id = " . $userdata['user_id'];
if ( !$db->sql_query($sql) )
{
message_die(GENERAL_ERROR, 'Could not update private message new/read time for user', '', __LINE__, __FILE__, $sql);
}
$s_privmsg_new = 1;
$icon_pm = $images['pm_new_msg'];
}
else
{
$s_privmsg_new = 0;
$icon_pm = $images['pm_new_msg'];
}
}
else
{
$l_privmsgs_text = $lang['No_new_pm'];
$s_privmsg_new = 0;
$icon_pm = $images['pm_no_new_msg'];
}
if ( $userdata['user_unread_privmsg'] )
{
$l_message_unread = ( $userdata['user_unread_privmsg'] == 1 ) ? $lang['Unread_pm'] : $lang['Unread_pms'];
$l_privmsgs_text_unread = sprintf($l_message_unread, $userdata['user_unread_privmsg']);
}
else
{
$l_privmsgs_text_unread = $lang['No_unread_pm'];
}
}
else
{
$icon_pm = $images['pm_no_new_msg'];
$l_privmsgs_text = $lang['Login_check_pm'];
$l_privmsgs_text_unread = '';
$s_privmsg_new = 0;
}
$template->assign_vars(array(
'L_LOGIN_LOGOUT' => $l_login_logout,
'L_PRIVATEMSGS' => $lang['Private_Messages'],
'L_PROFILE' => $lang['Profile'],
'PRIVATE_MESSAGE_INFO' => $l_privmsgs_text,
'PRIVATE_MESSAGE_INFO_UNREAD' => $l_privmsgs_text_unread,
'U_PRIVATEMSGS' => append_sid('privmsg.'.$phpEx.'?folder=inbox'),
'U_LOGIN_LOGOUT' => append_sid($u_login_logout),
'U_PROFILE' => append_sid('profile.'.$phpEx.'?mode=editprofile'),
)
);
$template->set_filenames(array(
"body" => "gn_logged_in.tpl")
);
$template->pparse("body");
}
else
{
if (!isset($board_config['allow_autologin']) || $board_config['allow_autologin'] )
{
$template->assign_block_vars('switch_allow_autologin', array());
$template->assign_block_vars('switch_user_logged_out.switch_allow_autologin', array());
}
$template->assign_vars(array(
'S_LOGIN_ACTION' => append_sid('forums/login.'.$phpEx),
)
);
// they're logged in, welcome them, check to see if they're admin, grab their info
$template->set_filenames(array(
"body" => "gn_login.tpl")
);
$template->pparse("body");
}
//That's It!
?>
I hope, there is a way to make the header work. Thaks in advance!