Rev Author Line No. Line
130 kaklik 1 <?php
2 /***************************************************************************
3 * profile.php
4 * -------------------
5 * begin : Saturday, Feb 13, 2001
6 * copyright : (C) 2001 The phpBB Group
7 * email : support@phpbb.com
8 *
9 * $Id: profile.php,v 1.193.2.7 2006/04/09 16:17:27 grahamje Exp $
10 *
11 *
12 ***************************************************************************/
13  
14 /***************************************************************************
15 *
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.
20 *
21 ***************************************************************************/
22  
23 define('IN_PHPBB', true);
24 $phpbb_root_path = './';
25 include($phpbb_root_path . 'extension.inc');
26 include($phpbb_root_path . 'common.'.$phpEx);
27  
28 //
29 // Start session management
30 //
31 $userdata = session_pagestart($user_ip, PAGE_PROFILE);
32 init_userprefs($userdata);
33 //
34 // End session management
35 //
36  
37 // session id check
38 if (!empty($HTTP_POST_VARS['sid']) || !empty($HTTP_GET_VARS['sid']))
39 {
40 $sid = (!empty($HTTP_POST_VARS['sid'])) ? $HTTP_POST_VARS['sid'] : $HTTP_GET_VARS['sid'];
41 }
42 else
43 {
44 $sid = '';
45 }
46  
47 //
48 // Set default email variables
49 //
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']) . '/' : '/';
55  
56 $server_url = $server_protocol . $server_name . $server_port . $script_name;
57  
58 // -----------------------
59 // Page specific functions
60 //
61 function gen_rand_string($hash)
62 {
63 $rand_str = dss_rand();
64  
65 return ( $hash ) ? md5($rand_str) : substr($rand_str, 0, 8);
66 }
67 //
68 // End page specific functions
69 // ---------------------------
70  
71 //
72 // Start of program proper
73 //
74 if ( isset($HTTP_GET_VARS['mode']) || isset($HTTP_POST_VARS['mode']) )
75 {
76 $mode = ( isset($HTTP_GET_VARS['mode']) ) ? $HTTP_GET_VARS['mode'] : $HTTP_POST_VARS['mode'];
77 $mode = htmlspecialchars($mode);
78  
79 if ( $mode == 'viewprofile' )
80 {
81 include($phpbb_root_path . 'includes/usercp_viewprofile.'.$phpEx);
82 exit;
83 }
84 else if ( $mode == 'editprofile' || $mode == 'register' )
85 {
86 if ( !$userdata['session_logged_in'] && $mode == 'editprofile' )
87 {
88 redirect(append_sid("login.$phpEx?redirect=profile.$phpEx&mode=editprofile", true));
89 }
90  
91 include($phpbb_root_path . 'includes/usercp_register.'.$phpEx);
92 exit;
93 }
94 else if ( $mode == 'confirm' )
95 {
96 // Visual Confirmation
97 if ( $userdata['session_logged_in'] )
98 {
99 exit;
100 }
101  
102 include($phpbb_root_path . 'includes/usercp_confirm.'.$phpEx);
103 exit;
104 }
105 else if ( $mode == 'sendpassword' )
106 {
107 include($phpbb_root_path . 'includes/usercp_sendpasswd.'.$phpEx);
108 exit;
109 }
110 else if ( $mode == 'activate' )
111 {
112 include($phpbb_root_path . 'includes/usercp_activate.'.$phpEx);
113 exit;
114 }
115 else if ( $mode == 'email' )
116 {
117 include($phpbb_root_path . 'includes/usercp_email.'.$phpEx);
118 exit;
119 }
120 }
121  
122 redirect(append_sid("index.$phpEx", true));
123  
124 ?>