5
* @version $Id: ucp_activate.php,v 1.29 2007/10/19 13:10:01 acydburn Exp $
6
* @copyright (c) 2005 phpBB Group
7
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
14
if (!defined('IN_PHPBB'))
28
function main($id, $mode)
30
global $config, $phpbb_root_path, $phpEx;
31
global $db, $user, $auth, $template;
33
$user_id = request_var('u', 0);
34
$key = request_var('k', '');
36
$sql = 'SELECT user_id, username, user_type, user_email, user_newpasswd, user_lang, user_notify_type, user_actkey, user_inactive_reason
37
FROM ' . USERS_TABLE . "
38
WHERE user_id = $user_id";
39
$result = $db->sql_query($sql);
40
$user_row = $db->sql_fetchrow($result);
41
$db->sql_freeresult($result);
45
trigger_error('NO_USER');
48
if ($user_row['user_type'] <> USER_INACTIVE && !$user_row['user_newpasswd'])
50
meta_refresh(3, append_sid("{$phpbb_root_path}index.$phpEx"));
51
trigger_error('ALREADY_ACTIVATED');
54
if ($user_row['user_actkey'] != $key)
56
trigger_error('WRONG_ACTIVATION');
59
$update_password = ($user_row['user_newpasswd']) ? true : false;
65
'user_password' => $user_row['user_newpasswd'],
66
'user_newpasswd' => '',
67
'user_pass_convert' => 0,
70
$sql = 'UPDATE ' . USERS_TABLE . '
71
SET ' . $db->sql_build_array('UPDATE', $sql_ary) . '
72
WHERE user_id = ' . $user_row['user_id'];
76
if (!$update_password)
78
include_once($phpbb_root_path . 'includes/functions_user.' . $phpEx);
80
user_active_flip('activate', $user_row['user_id']);
82
$sql = 'UPDATE ' . USERS_TABLE . "
84
WHERE user_id = {$user_row['user_id']}";
88
if ($config['require_activation'] == USER_ACTIVATION_ADMIN && !$update_password)
90
include_once($phpbb_root_path . 'includes/functions_messenger.' . $phpEx);
92
$messenger = new messenger(false);
94
$messenger->template('admin_welcome_activated', $user_row['user_lang']);
96
$messenger->to($user_row['user_email'], $user_row['username']);
98
$messenger->headers('X-AntiAbuse: Board servername - ' . $config['server_name']);
99
$messenger->headers('X-AntiAbuse: User_id - ' . $user->data['user_id']);
100
$messenger->headers('X-AntiAbuse: Username - ' . $user->data['username']);
101
$messenger->headers('X-AntiAbuse: User IP - ' . $user->ip);
103
$messenger->assign_vars(array(
104
'USERNAME' => htmlspecialchars_decode($user_row['username']))
107
$messenger->send($user_row['user_notify_type']);
109
$message = 'ACCOUNT_ACTIVE_ADMIN';
113
if (!$update_password)
115
$message = ($user_row['user_inactive_reason'] == INACTIVE_PROFILE) ? 'ACCOUNT_ACTIVE_PROFILE' : 'ACCOUNT_ACTIVE';
119
$message = 'PASSWORD_ACTIVATED';
123
meta_refresh(3, append_sid("{$phpbb_root_path}index.$phpEx"));
124
trigger_error($user->lang[$message]);
b'\\ No newline at end of file'