phpBB
Statistics
| Revision:

root / tags / release_2_0_2 / phpBB / profile.php

History | View | Annotate | Download (3.7 kB)

1 2 thefinn
<?php
2 169 thefinn
/***************************************************************************
3 169 thefinn
 *                                profile.php
4 169 thefinn
 *                            -------------------
5 169 thefinn
 *   begin                : Saturday, Feb 13, 2001
6 169 thefinn
 *   copyright            : (C) 2001 The phpBB Group
7 169 thefinn
 *   email                : support@phpbb.com
8 169 thefinn
 *
9 169 thefinn
 *   $Id$
10 169 thefinn
 *
11 169 thefinn
 *
12 169 thefinn
 ***************************************************************************/
13 2 thefinn
14 943 thefinn
/***************************************************************************
15 943 thefinn
 *
16 943 thefinn
 *   This program is free software; you can redistribute it and/or modify
17 943 thefinn
 *   it under the terms of the GNU General Public License as published by
18 943 thefinn
 *   the Free Software Foundation; either version 2 of the License, or
19 943 thefinn
 *   (at your option) any later version.
20 943 thefinn
 *
21 943 thefinn
 ***************************************************************************/
22 943 thefinn
23 2305 psotfx
define('IN_PHPBB', true);
24 2305 psotfx
$phpbb_root_path = './';
25 646 psotfx
include($phpbb_root_path . 'extension.inc');
26 646 psotfx
include($phpbb_root_path . 'common.'.$phpEx);
27 2 thefinn
28 143 psotfx
//
29 143 psotfx
// Start session management
30 143 psotfx
//
31 2183 psotfx
$userdata = session_pagestart($user_ip, PAGE_PROFILE);
32 143 psotfx
init_userprefs($userdata);
33 143 psotfx
//
34 143 psotfx
// End session management
35 143 psotfx
//
36 143 psotfx
37 2183 psotfx
//
38 2183 psotfx
// Set default email variables
39 2183 psotfx
//
40 2305 psotfx
$script_name = preg_replace('/^\/?(.*?)\/?$/', '\1', trim($board_config['script_path']));
41 2183 psotfx
$script_name = ( $script_name != '' ) ? $script_name . '/profile.'.$phpEx : 'profile.'.$phpEx;
42 2183 psotfx
$server_name = trim($board_config['server_name']);
43 2305 psotfx
$server_protocol = ( $board_config['cookie_secure'] ) ? 'https://' : 'http://';
44 2183 psotfx
$server_port = ( $board_config['server_port'] <> 80 ) ? ':' . trim($board_config['server_port']) . '/' : '/';
45 2183 psotfx
46 2191 psotfx
$server_url = $server_protocol . $server_name . $server_port . $script_name;
47 2183 psotfx
48 1083 psotfx
// -----------------------
49 1018 psotfx
// Page specific functions
50 1018 psotfx
//
51 2209 psotfx
function gen_rand_string($hash)
52 1155 psotfx
{
53 2305 psotfx
        $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');
54 1155 psotfx
55 1155 psotfx
        $max_chars = count($chars) - 1;
56 2305 psotfx
        srand( (double) microtime()*1000000);
57 1155 psotfx
58 2305 psotfx
        $rand_str = '';
59 1155 psotfx
        for($i = 0; $i < 8; $i++)
60 1155 psotfx
        {
61 2209 psotfx
                $rand_str = ( $i == 0 ) ? $chars[rand(0, $max_chars)] : $rand_str . $chars[rand(0, $max_chars)];
62 1155 psotfx
        }
63 1155 psotfx
64 2209 psotfx
        return ( $hash ) ? md5($rand_str) : $rand_str;
65 1155 psotfx
}
66 1038 natec
//
67 1018 psotfx
// End page specific functions
68 1155 psotfx
// ---------------------------
69 1018 psotfx
70 1018 psotfx
//
71 363 psotfx
// Start of program proper
72 421 thefinn
//
73 2305 psotfx
if ( isset($HTTP_GET_VARS['mode']) || isset($HTTP_POST_VARS['mode']) )
74 106 thefinn
{
75 1101 psotfx
        $mode = ( isset($HTTP_GET_VARS['mode']) ) ? $HTTP_GET_VARS['mode'] : $HTTP_POST_VARS['mode'];
76 2209 psotfx
77 2305 psotfx
        if ( $mode == 'viewprofile' )
78 311 psotfx
        {
79 2305 psotfx
                include($phpbb_root_path . 'includes/usercp_viewprofile.'.$phpEx);
80 2305 psotfx
                exit;
81 553 uid42062
        }
82 2305 psotfx
        else if ( $mode == 'editprofile' || $mode == 'register' )
83 553 uid42062
        {
84 2305 psotfx
                if ( !$userdata['session_logged_in'] && $mode == 'editprofile' )
85 553 uid42062
                {
86 2444 the_systech
                        $header_location = ( @preg_match("/Microsoft|WebSTAR|Xitami/", getenv("SERVER_SOFTWARE")) ) ? "Refresh: 0; URL=" : "Location: ";
87 2411 psotfx
                        header($header_location . append_sid("login.$phpEx?redirect=profile.$phpEx&mode=editprofile", true));
88 2305 psotfx
                        exit;
89 553 uid42062
                }
90 553 uid42062
91 2305 psotfx
                include($phpbb_root_path . 'includes/usercp_register.'.$phpEx);
92 2305 psotfx
                exit;
93 553 uid42062
        }
94 2305 psotfx
        else if ( $mode == 'sendpassword' )
95 1155 psotfx
        {
96 2305 psotfx
                include($phpbb_root_path . 'includes/usercp_sendpasswd.'.$phpEx);
97 2305 psotfx
                exit;
98 1155 psotfx
        }
99 2247 psotfx
        else if ( $mode == 'activate' )
100 553 uid42062
        {
101 2305 psotfx
                include($phpbb_root_path . 'includes/usercp_activate.'.$phpEx);
102 2305 psotfx
                exit;
103 311 psotfx
        }
104 2305 psotfx
        else if ( $mode == 'email' )
105 1316 psotfx
        {
106 2305 psotfx
                include($phpbb_root_path . 'includes/usercp_email.'.$phpEx);
107 2305 psotfx
                exit;
108 1316 psotfx
        }
109 106 thefinn
}
110 2305 psotfx
else
111 2305 psotfx
{
112 2444 the_systech
        $header_location = ( @preg_match("/Microsoft|WebSTAR|Xitami/", getenv("SERVER_SOFTWARE")) ) ? "Refresh: 0; URL=" : "Location: ";
113 2411 psotfx
        header($header_location . append_sid("index.$phpEx", true));
114 2305 psotfx
        exit;
115 2305 psotfx
}
116 106 thefinn
117 2444 the_systech
?>