1 rizwank 1.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.2 2002/12/03 20:55:30 psotfx 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 rizwank 1.1
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 rizwank 1.1 {
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 $chars = array( 'a', 'A', 'b', 'B', 'c', 'C', 'd', 'D', 'e', 'E', 'f', 'F', 'g', 'G', 'h', 'H', 'i', 'I', 'j', 'J', 'k', 'K', 'l', 'L', 'm', 'M', 'n', 'N', 'o', 'O', 'p', 'P', 'q', 'Q', 'r', 'R', 's', 'S', 't', 'T', 'u', 'U', 'v', 'V', 'w', 'W', 'x', 'X', 'y', 'Y', 'z', 'Z', '1', '2', '3', '4', '5', '6', '7', '8', '9', '0');
64 rizwank 1.1
65 $max_chars = count($chars) - 1;
66 srand( (double) microtime()*1000000);
67
68 $rand_str = '';
69 for($i = 0; $i < 8; $i++)
70 {
71 $rand_str = ( $i == 0 ) ? $chars[rand(0, $max_chars)] : $rand_str . $chars[rand(0, $max_chars)];
72 }
73
74 return ( $hash ) ? md5($rand_str) : $rand_str;
75 }
76 //
77 // End page specific functions
78 // ---------------------------
79
80 //
81 // Start of program proper
82 //
83 if ( isset($HTTP_GET_VARS['mode']) || isset($HTTP_POST_VARS['mode']) )
84 {
85 rizwank 1.1 $mode = ( isset($HTTP_GET_VARS['mode']) ) ? $HTTP_GET_VARS['mode'] : $HTTP_POST_VARS['mode'];
86
87 if ( $mode == 'viewprofile' )
88 {
89 include($phpbb_root_path . 'includes/usercp_viewprofile.'.$phpEx);
90 exit;
91 }
92 else if ( $mode == 'editprofile' || $mode == 'register' )
93 {
94 if ( !$userdata['session_logged_in'] && $mode == 'editprofile' )
95 {
96 redirect(append_sid("login.$phpEx?redirect=profile.$phpEx&mode=editprofile", true));
97 }
98
99 include($phpbb_root_path . 'includes/usercp_register.'.$phpEx);
100 exit;
101 }
102 else if ( $mode == 'sendpassword' )
103 {
104 include($phpbb_root_path . 'includes/usercp_sendpasswd.'.$phpEx);
105 exit;
106 rizwank 1.1 }
107 else if ( $mode == 'activate' )
108 {
109 include($phpbb_root_path . 'includes/usercp_activate.'.$phpEx);
110 exit;
111 }
112 else if ( $mode == 'email' )
113 {
114 include($phpbb_root_path . 'includes/usercp_email.'.$phpEx);
115 exit;
116 }
117 }
118 else
119 {
120 redirect(append_sid("index.$phpEx", true));
121 }
122
123 ?>
|