Login And Redirect To Current Page
after the login, it redirects you to forum.php
I would want that redirect to current page before login.
I have found this code for the login.php, but I think it is for phpbb2
<?php
define('IN_PHPBB', true);
$phpbb_root_path = (defined('PHPBB_ROOT_PATH')) ? PHPBB_ROOT_PATH : './';
$phpEx = substr(strrchr(__FILE__, '.'), 1);
require($phpbb_root_path . 'common.' . $phpEx);
require($phpbb_root_path . 'includes/functions_user.' . $phpEx);
require($phpbb_root_path . 'includes/functions_module.' . $phpEx);
// Start session management
$user->session_begin();
$auth->acl($user->data);
$user->setup('UCP');
if($user->data['is_registered'])
{
trigger_error('You are already logged in');
}
else
{
$username = request_var('username', '', true);
$password = request_var('password', '', true);
$autologin = (!empty($_POST['autologin'])) ? true : false;
$result = $auth->login($username, $password, $autologin);
if ($result['status'] == LOGIN_SUCCESS)
{
$redirect= $_SERVER['HTTP_REFERER'];
$url = redirect($redirect, true);
$time = 0; //Seconds to wait before redirect
echo '<meta http-equiv="refresh" content="' . $time . ';url=' . str_replace('&', '&', $url) . '" />';
}
else
{
trigger_error('Login failed');
}
}
?>
I found this similar topic, but I cannot find a solution...
www.icyphoenix.com/viewtopic.php?f=35&t=598