[ Index ] |
PHP Cross Reference of phpBB 3.0 Beta 3 |
[Summary view] [Print] [Text view]
1 <?php 2 /** 3 * 4 * @package ucp 5 * @version $Id: ucp_activate.php,v 1.25 2006/11/03 21:04:10 acydburn Exp $ 6 * @copyright (c) 2005 phpBB Group 7 * @license http://opensource.org/licenses/gpl-license.php GNU Public License 8 * 9 */ 10 11 /** 12 * ucp_activate 13 * User activation 14 * @package ucp 15 */ 16 class ucp_activate 17 { 18 var $u_action; 19 20 function main($id, $mode) 21 { 22 global $config, $phpbb_root_path, $phpEx; 23 global $db, $user, $auth, $template; 24 25 $user_id = request_var('u', 0); 26 $key = request_var('k', ''); 27 28 $sql = 'SELECT user_id, username, user_type, user_email, user_newpasswd, user_lang, user_notify_type, user_actkey 29 FROM ' . USERS_TABLE . " 30 WHERE user_id = $user_id"; 31 $result = $db->sql_query($sql); 32 $user_row = $db->sql_fetchrow($result); 33 $db->sql_freeresult($result); 34 35 if (!$user_row) 36 { 37 trigger_error('NO_USER'); 38 } 39 40 if ($user_row['user_type'] <> USER_INACTIVE && !$user_row['user_newpasswd']) 41 { 42 meta_refresh(3, append_sid("{$phpbb_root_path}index.$phpEx")); 43 trigger_error('ALREADY_ACTIVATED'); 44 } 45 46 if ($user_row['user_actkey'] != $key) 47 { 48 trigger_error('WRONG_ACTIVATION'); 49 } 50 51 $update_password = ($user_row['user_newpasswd']) ? true : false; 52 53 if ($update_password) 54 { 55 $sql_ary = array( 56 'user_actkey' => '', 57 'user_password' => $user_row['user_newpasswd'], 58 'user_newpasswd' => '' 59 ); 60 61 $sql = 'UPDATE ' . USERS_TABLE . ' 62 SET ' . $db->sql_build_array('UPDATE', $sql_ary) . ' 63 WHERE user_id = ' . $user_row['user_id']; 64 $db->sql_query($sql); 65 } 66 67 if (!$update_password) 68 { 69 include_once($phpbb_root_path . 'includes/functions_user.' . $phpEx); 70 71 user_active_flip('activate', $user_row['user_id']); 72 73 $sql = 'UPDATE ' . USERS_TABLE . " 74 SET user_actkey = '' 75 WHERE user_id = {$user_row['user_id']}"; 76 $db->sql_query($sql); 77 } 78 79 if ($config['require_activation'] == USER_ACTIVATION_ADMIN && !$update_password) 80 { 81 include_once($phpbb_root_path . 'includes/functions_messenger.' . $phpEx); 82 83 $messenger = new messenger(false); 84 85 $messenger->template('admin_welcome_activated', $user_row['user_lang']); 86 87 $messenger->replyto($config['board_contact']); 88 $messenger->to($user_row['user_email'], $user_row['username']); 89 90 $messenger->headers('X-AntiAbuse: Board servername - ' . $config['server_name']); 91 $messenger->headers('X-AntiAbuse: User_id - ' . $user->data['user_id']); 92 $messenger->headers('X-AntiAbuse: Username - ' . $user->data['username']); 93 $messenger->headers('X-AntiAbuse: User IP - ' . $user->ip); 94 95 $messenger->assign_vars(array( 96 'USERNAME' => htmlspecialchars_decode($user_row['username'])) 97 ); 98 99 $messenger->send($user_row['user_notify_type']); 100 101 $message = 'ACCOUNT_ACTIVE_ADMIN'; 102 } 103 else 104 { 105 $message = (!$update_password) ? 'ACCOUNT_ACTIVE' : 'PASSWORD_ACTIVATED'; 106 } 107 108 meta_refresh(3, append_sid("{$phpbb_root_path}index.$phpEx")); 109 trigger_error($user->lang[$message]); 110 } 111 } 112 113 ?>
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Wed Nov 22 00:35:05 2006 | Cross-referenced by PHPXref 0.6 |