##############################################################
# Title: Redirect After Registration
# Author: Thoul thoul@users.sourceforge.net h**p://darkmods.sourceforge.net
# Description: Allows redirection on the registration confirmation page.
# Version: 2.3.4
# Installation Level: Easy
# Installation Time: 5 Minutes
# Files To Edit: includes/usercp_register.php, login.php
# Included Files: n/a
##############################################################
# Author's Notes:
# This MOD allows you to redirect a user, to a page you specify, after they've
# registered. You have an option of allowing the user to be automatically logged in
# on that page also. (Don't confuse this phpBB's "Log me on automatically each
# visit" feature - this is a one time login. Usually, anyway.)
#
# There are four variables in the code to be added that you can change to modify
# how this mod behaves. They are found on these lines:
# $register_redirect = "index.$phpEx";
# $rds_auto_login = TRUE;
# $rds_auto_each_login = 1;
# $rds_outside = FALSE;
#
# $register_redirect should be set to the url of the page to which the user will be
# redirected after registering. For example, if you want them to go to
# h**p://site.com/index.html, that line needs to read:
# $register_redirect = '/index.html';
#
# If you are redirecting users to pages outside of your phpBB directories (aka
# folders), be sure to read the file function_change.txt also. It contains other
# modifications and instructions that you will need to read.
#
# $rds_auto_login should be set to either TRUE or FALSE. If it is true and your
# board does not require account activation, then the user will automatically be
# logged in when sent to the page specified in $register_redirect (assuming that
# page is a phpBB enabled page). The registration confirmation page will not be
# displayed in this case. If $rds_auto_login is FALSE or your board does require
# account activation, then the user is redirected to the page specified in
# $register_redirect and the registration confirmation page will be displayed.
# Examples:
# $rds_auto_login = TRUE;
# $rds_auto_login = FALSE;
#
# $rds_auto_each_login should be set to either TRUE or FALSE. If it is set to true,
# then the user will automatically be logged in each visit (just as if they had
# checked the box on the login page).
# Examples:
# $rds_auto_each_login = TRUE;
# $rds_auto_each_login = FALSE;
#
# (Special Notes: If you are familiar enough with phpBB, it's possible to add
# options to the registration form that will let the user choose if they want to
# be logged in automatically after registering ($rds_auto_login) or logged in
# automatically each visit ($rds_auto_each_login). I might add it to a future
# version of the mod as well, if someone wants the code for it.)
##############################################################
# BEFORE ADDING THIS TO YOUR FORUM, YOU SHOULD BACK UP ALL RELATED FILES.
##############################################################
#
#-----[ OPEN ]------------------------------------------
#
includes/usercp_register.php
#
#-----[ FIND ]------------------------------------------
#
$message = $message . '<br /><br />' . sprintf($lang['Click_return_index'], '<a href="' . append_sid("index.$phpEx") . '">', '</a>');
#
#-----[ REPLACE WITH ]------------------------------------------
#
/* Original phpBB code - commented out for Redirect After Registration
$message = $message . '<br /><br />' . sprintf($lang['Click_return_index'], '<a href="' . append_sid("index.$phpEx") . '">', '</a>');
*/
//---------------------------------------------------------------------------------
// Redirect After Registration - Begin Code Addition
//
$register_redirect = 'index.' . $phpEx;
// Automatically log user in after registering? TRUE or FALSE
$rds_auto_login = TRUE;
// Automatically log user in each visit? TRUE or FALSE
$rds_auto_each_login = TRUE;
// Redirecting to a url outside phpBB directories? TRUE or FALSE
$rds_outside = FALSE;
if ( $rds_auto_login && $board_config['require_activation'] == USER_ACTIVATION_NONE )
{
$login_str = '?username=' . urlencode($username) . '&password=' . urlencode($password_confirm) . '&login=Login';
if ( $rds_auto_each_login )
{
$login_str .= '&autologin=1';
}
$redirect_str = '&redirect=' . $register_redirect;
if ( $rds_outside )
{
$redirect_str .= '&outside=1';
}
redirect(append_sid('login.' .$phpEx . $login_str . $redirect_str, true));
}
else
{
$message = $message . '<br /><br />' . sprintf($lang['Click_return_index'], '<a href="' . append_sid($register_redirect) . '">', '</a>');
$template->assign_vars(array(
"META" => '<meta http-equiv="refresh" content="5;url=' . append_sid($register_redirect) . '">')
);
}
//
// Redirect After Registration - End Code Addition
//---------------------------------------------------------------------------------
#
#-----[ OPEN ]------------------------------------------
#
login.php
#
#-----[ FIND ]------------------------------------------
#
$username = isset($HTTP_POST_VARS['username']) ? trim(htmlspecialchars($HTTP_POST_VARS['username'])) : '';
#
#-----[ REPLACE WITH ]------------------------------------------
#
/* Original phpBB code - commented out for Redirect After Registration
$username = isset($HTTP_POST_VARS['username']) ? trim(htmlspecialchars($HTTP_POST_VARS['username'])) : '';
*/
//---------------------------------------------------------------------------------
// Redirect After Registration - Begin Code Addition
//
$username = isset($HTTP_POST_VARS['username']) ? $HTTP_POST_VARS['username'] : (isset($HTTP_GET_VARS['username']) ? urldecode($HTTP_GET_VARS['username']) : '');
$username = trim(htmlspecialchars($username));
//
// Redirect After Registration - End Code Addition
//---------------------------------------------------------------------------------
#
#-----[ FIND ]------------------------------------------
#
$password = isset($HTTP_POST_VARS['password']) ? $HTTP_POST_VARS['password'] : '';
#
#-----[ REPLACE WITH ]------------------------------------------
#
/* Original phpBB code - commented out for Redirect After Registration
$password = isset($HTTP_POST_VARS['password']) ? $HTTP_POST_VARS['password'] : '';
*/
//---------------------------------------------------------------------------------
// Redirect After Registration - Begin Code Addition
//
$password = isset($HTTP_POST_VARS['password']) ? $HTTP_POST_VARS['password'] : (isset($HTTP_GET_VARS['password']) ? urldecode($HTTP_GET_VARS['password']) : '');
//
// Redirect After Registration - End Code Addition
//---------------------------------------------------------------------------------
#
#-----[ FIND ]------------------------------------------
#
$autologin = ( isset($HTTP_POST_VARS['autologin']) ) ? TRUE : 0;
#
#-----[ REPLACE WITH ]------------------------------------------
#
/* Original phpBB code - commented out for Redirect After Registration
$autologin = ( isset($HTTP_POST_VARS['autologin']) ) ? TRUE : 0;
*/
//---------------------------------------------------------------------------------
// Redirect After Registration - Begin Code Addition
//
$autologin = isset($HTTP_POST_VARS['autologin']) ? TRUE : ( isset($HTTP_GET_VARS['autologin'] ) ? TRUE : 0);
//
// Redirect After Registration - End Code Addition
//---------------------------------------------------------------------------------
#
#-----[ FIND ]------------------------------------------
#
if( $session_id )
{
$url = ( !empty($HTTP_POST_VARS['redirect']) ) ? str_replace('&', '&', htmlspecialchars($HTTP_POST_VARS['redirect'])) : "index.$phpEx";
redirect(append_sid($url, true));
}
#
#-----[ REPLACE WITH ]------------------------------------------
#
/* Original phpBB code - commented out for Redirect After Registration
if( $session_id )
{
$url = ( !empty($HTTP_POST_VARS['redirect']) ) ? str_replace('&', '&', htmlspecialchars($HTTP_POST_VARS['redirect'])) : "index.$phpEx";
redirect(append_sid($url, true));
}
*/
//---------------------------------------------------------------------------------
// Redirect After Registration - Begin Code Addition
//
if( $session_id )
{
$url = ( !empty($_REQUEST['redirect']) ) ? str_replace('&', '&', htmlspecialchars(addslashes($_REQUEST['redirect']))) : 'index.' . $phpEx;
$outside = ( !empty($_REQUEST['outside']) ) ? true : false;
redirect(append_sid($url, true), $outside);
}
//
// Redirect After Registration - End Code Addition
//---------------------------------------------------------------------------------
#
#-----[ SAVE/CLOSE ALL FILES ]------------------------------------------
#
# End