Your website being the forum? Or some external page? I assume the website is the forum.
Open includes/session.php
Replace the code you added above with this
- Code: Select all
if ($this->data['user_id'] == ANONYMOUS && strpos($this->page['page'], "index.$phpEx") === false && strpos($this->page['page'], "ucp.$phpEx") === false)
{
redirect(append_sid("{$phpbb_root_path}index.$phpEx"));
}
Open index.php
FIND
- Code: Select all
$user->setup('viewforum');
ADD AFTER
- Code: Select all
if ($user->data['user_id'] == ANONYMOUS)
{
$user->add_lang('ucp');
$s_hidden_fields = array(
'sid' => $user->session_id,
'redirect' => "{$phpbb_root_path}index.$phpEx"
);
$template->set_filenames(array(
'body' => 'login_body.html'
));
$s_hidden_fields = build_hidden_fields($s_hidden_fields);
$template->assign_vars(array(
'USERNAME' => '',
'USERNAME_CREDENTIAL' => 'username',
'PASSWORD_CREDENTIAL' => 'password',
'S_AUTOLOGIN_ENABLED' => ($config['allow_autologin']) ? true : false,
'S_DISPLAY_FULL_LOGIN' => true,
'S_HIDDEN_FIELDS' => $s_hidden_fields,
'S_LOGIN_ACTION' => append_sid("{$phpbb_root_path}ucp.$phpEx", 'mode=login'),
'S_LOGIN_REDIRECT' => build_hidden_fields(array('redirect' => build_url())),
'U_RESEND_ACTIVATION' => ($config['require_activation'] == USER_ACTIVATION_SELF && $config['email_enable']) ? append_sid("{$phpbb_root_path}ucp.$phpEx", 'mode=resend_act') : '',
'U_SEND_PASSWORD' => ($config['email_enable']) ? append_sid("{$phpbb_root_path}ucp.$phpEx", 'mode=sendpassword') : '',
));
// Output page
page_header($user->lang['LOGIN']);
page_footer();
}
Unless you plan to replace the whole index.php with ucp.php you need to have it accessible for guests. You could of course with some more edits incluce ucp.php in index.php when the user is not logged in. So guests never can access ucp.php. But I'm to tired to think about that now, need to get some sleep.