All, I have been trying to get my instance of PHPBB to redirect to a certain page if it is the first of the month. All other days of the month I want the redirect to the index page.
I have tried modifying the includes/functions.php to include the redirect and the ucp.php page to include the new redirect.
includes/functions.php:
// The result parameter is always an array, holding the relevant information...
if ($result['status'] == LOGIN_SUCCESS)
{
date_default_timezone_set('EST');
$firstday = date('Y-m-01');
$today = date('Y-m-d');
if ($firstday == $today){
$redirect = request_var('redirect', "{$phpbb_root_path}projects/index.$phpEx");
$message = ($l_success) ? $l_success : $user->lang['LOGIN_REDIRECT'];
$l_redirect = ($admin) ? $user->lang['PROCEED_TO_ACP'] : (($redirect === "{$phpbb_root_path}projects/index.$phpEx" || $redirect === "projects/index.$phpEx") ? $user->lang['RETURN_INDEX'] : $user->lang['RETURN_PAGE']);
}
else{
$redirect = request_var('redirect', "{$phpbb_root_path}index.$phpEx");
$message = ($l_success) ? $l_success : $user->lang['LOGIN_REDIRECT'];
$l_redirect = ($admin) ? $user->lang['PROCEED_TO_ACP'] : (($redirect === "{$phpbb_root_path}index.$phpEx" || $redirect === "index.$phpEx") ? $user->lang['RETURN_INDEX'] : $user->lang['RETURN_PAGE']);
}
// append/replace SID (may change during the session for AOL users)
$redirect = reapply_sid($redirect);
and the ucp.php:
case 'login':
date_default_timezone_set('EST');
$firstday = date('Y-m-30');
$today = date('Y-m-d');
if (($user->data['is_registered']) && ($today == $firstdate))
{
redirect(append_sid("{$phpbb_root_path}projects/index.$phpEx"));
}
else{
redirect(append_sid("{$phpbb_root_path}index.$phpEx"));
}
login_box(request_var('redirect', "index.$phpEx"));
break;
However using one or both of these does not return a successful redirect. The user is logged in and a
This page cannot be displayed.
message shows up.
Is there a better way of doing this? It would be nice to get this redirect to work.