2 /***************************************************************************
5 * begin : Saturday, Feb 13, 2001
6 * copyright : (C) 2001 The phpBB Group
7 * email : support@phpbb.com
9 * $Id: profile.php,v 1.193.2.7 2006/04/09 16:17:27 grahamje Exp $
12 ***************************************************************************/
14 /***************************************************************************
16 * This program is free software; you can redistribute it and/or modify
17 * it under the terms of the GNU General Public License as published by
18 * the Free Software Foundation; either version 2 of the License, or
19 * (at your option) any later version.
21 ***************************************************************************/
23 define('IN_PHPBB', true);
24 $phpbb_root_path = './';
25 include($phpbb_root_path . 'extension.inc');
26 include($phpbb_root_path . 'common.'.$phpEx);
29 // Start session management
31 $userdata = session_pagestart($user_ip, PAGE_PROFILE);
32 init_userprefs($userdata);
34 // End session management
38 if (!empty($HTTP_POST_VARS['sid']) || !empty($HTTP_GET_VARS['sid']))
40 $sid = (!empty($HTTP_POST_VARS['sid'])) ? $HTTP_POST_VARS['sid'] : $HTTP_GET_VARS['sid'];
48 // Set default email variables
50 $script_name = preg_replace('/^\/?(.*?)\/?$/', '\1', trim($board_config['script_path']));
51 $script_name = ( $script_name != '' ) ? $script_name . '/profile.'.$phpEx : 'profile.'.$phpEx;
52 $server_name = trim($board_config['server_name']);
53 $server_protocol = ( $board_config['cookie_secure'] ) ? 'https://' : 'http://';
54 $server_port = ( $board_config['server_port'] <> 80 ) ? ':' . trim($board_config['server_port']) . '/' : '/';
56 $server_url = $server_protocol . $server_name . $server_port . $script_name;
58 // -----------------------
59 // Page specific functions
61 function gen_rand_string($hash)
63 $rand_str = dss_rand();
65 return ( $hash ) ? md5($rand_str) : substr($rand_str, 0, 8);
68 // End page specific functions
69 // ---------------------------
72 // Start of program proper
74 if ( isset($HTTP_GET_VARS['mode']) || isset($HTTP_POST_VARS['mode']) )
76 $mode = ( isset($HTTP_GET_VARS['mode']) ) ? $HTTP_GET_VARS['mode'] : $HTTP_POST_VARS['mode'];
77 $mode = htmlspecialchars($mode);
79 if ( $mode == 'viewprofile' )
81 include($phpbb_root_path . 'includes/usercp_viewprofile.'.$phpEx);
84 else if ( $mode == 'editprofile' || $mode == 'reg' )
86 if ( !$userdata['session_logged_in'] && $mode == 'editprofile' )
88 redirect(append_sid("login.$phpEx?redirect=profile.$phpEx&mode=editprofile", true));
91 include($phpbb_root_path . 'includes/usercp_register.'.$phpEx);
94 else if ( $mode == 'conf' )
96 // Visual Confirmation
97 if ( $userdata['session_logged_in'] )
102 include($phpbb_root_path . 'includes/usercp_confirm.'.$phpEx);
105 else if ( $mode == 'sendpassword' )
107 include($phpbb_root_path . 'includes/usercp_sendpasswd.'.$phpEx);
110 else if ( $mode == 'activate' )
112 include($phpbb_root_path . 'includes/usercp_activate.'.$phpEx);
115 else if ( $mode == 'email' )
117 include($phpbb_root_path . 'includes/usercp_email.'.$phpEx);
122 redirect(append_sid("index.$phpEx", true));