2001-02-17 08:37:32 +00:00
|
|
|
<?php
|
2001-04-17 07:14:50 +00:00
|
|
|
/***************************************************************************
|
|
|
|
* profile.php
|
|
|
|
* -------------------
|
|
|
|
* begin : Saturday, Feb 13, 2001
|
|
|
|
* copyright : (C) 2001 The phpBB Group
|
|
|
|
* email : support@phpbb.com
|
|
|
|
*
|
|
|
|
* $Id$
|
|
|
|
*
|
|
|
|
*
|
|
|
|
***************************************************************************/
|
2001-02-17 08:37:32 +00:00
|
|
|
|
2001-08-30 22:20:23 +00:00
|
|
|
/***************************************************************************
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation; either version 2 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
***************************************************************************/
|
|
|
|
|
2002-03-18 13:35:43 +00:00
|
|
|
define('IN_PHPBB', true);
|
|
|
|
$phpbb_root_path = './';
|
2001-07-13 16:14:37 +00:00
|
|
|
include($phpbb_root_path . 'extension.inc');
|
|
|
|
include($phpbb_root_path . 'common.'.$phpEx);
|
2001-02-17 08:37:32 +00:00
|
|
|
|
2001-04-15 14:14:56 +00:00
|
|
|
//
|
|
|
|
// Start session management
|
|
|
|
//
|
2002-02-18 12:34:38 +00:00
|
|
|
$userdata = session_pagestart($user_ip, PAGE_PROFILE);
|
2001-04-15 14:14:56 +00:00
|
|
|
init_userprefs($userdata);
|
|
|
|
//
|
|
|
|
// End session management
|
|
|
|
//
|
|
|
|
|
2002-02-18 12:34:38 +00:00
|
|
|
//
|
|
|
|
// Set default email variables
|
|
|
|
//
|
2002-03-18 13:35:43 +00:00
|
|
|
$script_name = preg_replace('/^\/?(.*?)\/?$/', '\1', trim($board_config['script_path']));
|
2002-02-18 12:34:38 +00:00
|
|
|
$script_name = ( $script_name != '' ) ? $script_name . '/profile.'.$phpEx : 'profile.'.$phpEx;
|
|
|
|
$server_name = trim($board_config['server_name']);
|
2002-03-18 13:35:43 +00:00
|
|
|
$server_protocol = ( $board_config['cookie_secure'] ) ? 'https://' : 'http://';
|
2002-02-18 12:34:38 +00:00
|
|
|
$server_port = ( $board_config['server_port'] <> 80 ) ? ':' . trim($board_config['server_port']) . '/' : '/';
|
|
|
|
|
2002-02-18 21:29:55 +00:00
|
|
|
$server_url = $server_protocol . $server_name . $server_port . $script_name;
|
2002-02-18 12:34:38 +00:00
|
|
|
|
2001-09-25 18:18:47 +00:00
|
|
|
// -----------------------
|
2001-09-09 23:22:29 +00:00
|
|
|
// Page specific functions
|
|
|
|
//
|
2002-02-25 01:17:59 +00:00
|
|
|
function gen_rand_string($hash)
|
2001-10-10 17:27:34 +00:00
|
|
|
{
|
2002-03-18 13:35:43 +00:00
|
|
|
$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');
|
2001-10-10 17:27:34 +00:00
|
|
|
|
|
|
|
$max_chars = count($chars) - 1;
|
2002-03-18 13:35:43 +00:00
|
|
|
srand( (double) microtime()*1000000);
|
2001-10-10 17:27:34 +00:00
|
|
|
|
2002-03-18 13:35:43 +00:00
|
|
|
$rand_str = '';
|
2001-10-10 17:27:34 +00:00
|
|
|
for($i = 0; $i < 8; $i++)
|
|
|
|
{
|
2002-02-25 01:17:59 +00:00
|
|
|
$rand_str = ( $i == 0 ) ? $chars[rand(0, $max_chars)] : $rand_str . $chars[rand(0, $max_chars)];
|
2001-10-10 17:27:34 +00:00
|
|
|
}
|
|
|
|
|
2002-02-25 01:17:59 +00:00
|
|
|
return ( $hash ) ? md5($rand_str) : $rand_str;
|
2001-10-10 17:27:34 +00:00
|
|
|
}
|
2001-09-09 23:22:29 +00:00
|
|
|
//
|
|
|
|
// End page specific functions
|
2001-10-10 17:27:34 +00:00
|
|
|
// ---------------------------
|
2001-09-09 23:22:29 +00:00
|
|
|
|
2001-05-28 16:05:57 +00:00
|
|
|
//
|
|
|
|
// Start of program proper
|
2001-06-03 23:10:07 +00:00
|
|
|
//
|
2002-03-18 13:35:43 +00:00
|
|
|
if ( isset($HTTP_GET_VARS['mode']) || isset($HTTP_POST_VARS['mode']) )
|
2001-03-19 01:35:04 +00:00
|
|
|
{
|
2001-09-28 00:14:52 +00:00
|
|
|
$mode = ( isset($HTTP_GET_VARS['mode']) ) ? $HTTP_GET_VARS['mode'] : $HTTP_POST_VARS['mode'];
|
2002-02-25 01:17:59 +00:00
|
|
|
|
2002-03-18 13:35:43 +00:00
|
|
|
if ( $mode == 'viewprofile' )
|
2001-05-17 14:48:39 +00:00
|
|
|
{
|
2002-03-18 13:35:43 +00:00
|
|
|
include($phpbb_root_path . 'includes/usercp_viewprofile.'.$phpEx);
|
|
|
|
exit;
|
2001-07-04 19:36:32 +00:00
|
|
|
}
|
2002-03-18 13:35:43 +00:00
|
|
|
else if ( $mode == 'editprofile' || $mode == 'register' )
|
2001-07-04 19:36:32 +00:00
|
|
|
{
|
2002-03-18 13:35:43 +00:00
|
|
|
if ( !$userdata['session_logged_in'] && $mode == 'editprofile' )
|
2001-07-04 19:36:32 +00:00
|
|
|
{
|
2002-03-28 19:52:21 +00:00
|
|
|
$header_location = ( @preg_match("/Microsoft|WebSTAR|Xitami/", getenv("SERVER_SOFTWARE")) ) ? "Refresh: 0; URL=" : "Location: ";
|
2002-03-22 23:17:06 +00:00
|
|
|
header($header_location . append_sid("login.$phpEx?redirect=profile.$phpEx&mode=editprofile", true));
|
2002-03-18 13:35:43 +00:00
|
|
|
exit;
|
2001-07-04 19:36:32 +00:00
|
|
|
}
|
2001-05-17 14:48:39 +00:00
|
|
|
|
2002-03-18 13:35:43 +00:00
|
|
|
include($phpbb_root_path . 'includes/usercp_register.'.$phpEx);
|
|
|
|
exit;
|
2001-07-04 19:36:32 +00:00
|
|
|
}
|
2002-03-18 13:35:43 +00:00
|
|
|
else if ( $mode == 'sendpassword' )
|
2001-10-10 17:27:34 +00:00
|
|
|
{
|
2002-03-18 13:35:43 +00:00
|
|
|
include($phpbb_root_path . 'includes/usercp_sendpasswd.'.$phpEx);
|
|
|
|
exit;
|
2001-10-10 17:27:34 +00:00
|
|
|
}
|
2002-03-02 18:12:19 +00:00
|
|
|
else if ( $mode == 'activate' )
|
2001-07-04 19:36:32 +00:00
|
|
|
{
|
2002-03-18 13:35:43 +00:00
|
|
|
include($phpbb_root_path . 'includes/usercp_activate.'.$phpEx);
|
|
|
|
exit;
|
2001-05-17 14:48:39 +00:00
|
|
|
}
|
2002-03-18 13:35:43 +00:00
|
|
|
else if ( $mode == 'email' )
|
2001-11-15 16:26:41 +00:00
|
|
|
{
|
2002-03-18 13:35:43 +00:00
|
|
|
include($phpbb_root_path . 'includes/usercp_email.'.$phpEx);
|
|
|
|
exit;
|
2001-11-15 16:26:41 +00:00
|
|
|
}
|
2001-03-19 01:35:04 +00:00
|
|
|
}
|
2002-03-18 13:35:43 +00:00
|
|
|
else
|
|
|
|
{
|
2002-03-28 19:52:21 +00:00
|
|
|
$header_location = ( @preg_match("/Microsoft|WebSTAR|Xitami/", getenv("SERVER_SOFTWARE")) ) ? "Refresh: 0; URL=" : "Location: ";
|
2002-03-22 23:17:06 +00:00
|
|
|
header($header_location . append_sid("index.$phpEx", true));
|
2002-03-18 13:35:43 +00:00
|
|
|
exit;
|
|
|
|
}
|
2001-03-19 01:35:04 +00:00
|
|
|
|
2002-03-28 19:52:21 +00:00
|
|
|
?>
|