root / tags / release_2_0_2 / phpBB / profile.php
History | View | Annotate | Download (3.7 kB)
| 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 2444 2002-03-28 19:52:21Z the_systech $ |
| 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 | //
|
| 38 | // Set default email variables
|
| 39 | //
|
| 40 | $script_name = preg_replace('/^\/?(.*?)\/?$/', '\1', trim($board_config['script_path'])); |
| 41 | $script_name = ( $script_name != '' ) ? $script_name . '/profile.'.$phpEx : 'profile.'.$phpEx; |
| 42 | $server_name = trim($board_config['server_name']); |
| 43 | $server_protocol = ( $board_config['cookie_secure'] ) ? 'https://' : 'http://'; |
| 44 | $server_port = ( $board_config['server_port'] <> 80 ) ? ':' . trim($board_config['server_port']) . '/' : '/'; |
| 45 | |
| 46 | $server_url = $server_protocol . $server_name . $server_port . $script_name; |
| 47 | |
| 48 | // -----------------------
|
| 49 | // Page specific functions
|
| 50 | //
|
| 51 | function gen_rand_string($hash) |
| 52 | {
|
| 53 | $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 | |
| 55 | $max_chars = count($chars) - 1; |
| 56 | srand( (double) microtime()*1000000); |
| 57 | |
| 58 | $rand_str = ''; |
| 59 | for($i = 0; $i < 8; $i++) |
| 60 | {
|
| 61 | $rand_str = ( $i == 0 ) ? $chars[rand(0, $max_chars)] : $rand_str . $chars[rand(0, $max_chars)]; |
| 62 | } |
| 63 | |
| 64 | return ( $hash ) ? md5($rand_str) : $rand_str; |
| 65 | } |
| 66 | //
|
| 67 | // End page specific functions
|
| 68 | // ---------------------------
|
| 69 | |
| 70 | //
|
| 71 | // Start of program proper
|
| 72 | //
|
| 73 | if ( isset($HTTP_GET_VARS['mode']) || isset($HTTP_POST_VARS['mode']) ) |
| 74 | {
|
| 75 | $mode = ( isset($HTTP_GET_VARS['mode']) ) ? $HTTP_GET_VARS['mode'] : $HTTP_POST_VARS['mode']; |
| 76 | |
| 77 | if ( $mode == 'viewprofile' ) |
| 78 | {
|
| 79 | include($phpbb_root_path . 'includes/usercp_viewprofile.'.$phpEx); |
| 80 | exit;
|
| 81 | } |
| 82 | else if ( $mode == 'editprofile' || $mode == 'register' ) |
| 83 | {
|
| 84 | if ( !$userdata['session_logged_in'] && $mode == 'editprofile' ) |
| 85 | {
|
| 86 | $header_location = ( @preg_match("/Microsoft|WebSTAR|Xitami/", getenv("SERVER_SOFTWARE")) ) ? "Refresh: 0; URL=" : "Location: "; |
| 87 | header($header_location . append_sid("login.$phpEx?redirect=profile.$phpEx&mode=editprofile", true)); |
| 88 | exit;
|
| 89 | } |
| 90 | |
| 91 | include($phpbb_root_path . 'includes/usercp_register.'.$phpEx); |
| 92 | exit;
|
| 93 | } |
| 94 | else if ( $mode == 'sendpassword' ) |
| 95 | {
|
| 96 | include($phpbb_root_path . 'includes/usercp_sendpasswd.'.$phpEx); |
| 97 | exit;
|
| 98 | } |
| 99 | else if ( $mode == 'activate' ) |
| 100 | {
|
| 101 | include($phpbb_root_path . 'includes/usercp_activate.'.$phpEx); |
| 102 | exit;
|
| 103 | } |
| 104 | else if ( $mode == 'email' ) |
| 105 | {
|
| 106 | include($phpbb_root_path . 'includes/usercp_email.'.$phpEx); |
| 107 | exit;
|
| 108 | } |
| 109 | } |
| 110 | else
|
| 111 | {
|
| 112 | $header_location = ( @preg_match("/Microsoft|WebSTAR|Xitami/", getenv("SERVER_SOFTWARE")) ) ? "Refresh: 0; URL=" : "Location: "; |
| 113 | header($header_location . append_sid("index.$phpEx", true)); |
| 114 | exit;
|
| 115 | } |
| 116 | |
| 117 | ?>
|

