mirror of
https://github.com/phpbb/phpbb.git
synced 2025-10-28 14:08:23 +01:00
Tons of work on the UCP, see my topic in the development forum for more info
on the bigger changes. Registration should still work, the basic layout of the UCP is also done with the start on the profile settings area. git-svn-id: file:///svn/phpbb/trunk@3591 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
@@ -20,55 +20,37 @@
|
||||
*
|
||||
***************************************************************************/
|
||||
|
||||
if ( !defined('IN_PHPBB') )
|
||||
|
||||
if (!defined('IN_PHPBB'))
|
||||
{
|
||||
die('Hacking attempt');
|
||||
exit;
|
||||
}
|
||||
|
||||
//
|
||||
// The User Control Panel uses Barts 'neat-o-module' system (tm) system to handle the tabs.
|
||||
// This block specifies the tabs and sub tabs for this section.
|
||||
//
|
||||
if( !empty($setmodules) )
|
||||
{
|
||||
$filename = str_replace(".$phpEx", '', basename(__FILE__));
|
||||
|
||||
return;
|
||||
}
|
||||
//
|
||||
// End Modules setup
|
||||
//
|
||||
|
||||
$sql = "SELECT user_active, user_id, user_email, user_newpasswd, user_lang, user_actkey
|
||||
$sql = "SELECT user_active, user_id, user_email, user_newpasswd, user_lang, user_actkey, username
|
||||
FROM " . USERS_TABLE . "
|
||||
WHERE user_id = " . intval($HTTP_GET_VARS[POST_USERS_URL]);
|
||||
if ( !($result = $db->sql_query($sql)) )
|
||||
{
|
||||
message_die(GENERAL_ERROR, 'Could not obtain user information', '', __LINE__, __FILE__, $sql);
|
||||
}
|
||||
WHERE user_id = " . intval($_GET['u']);
|
||||
$result = $db->sql_query($sql);
|
||||
|
||||
if ( $row = $db->sql_fetchrow($result) )
|
||||
{
|
||||
if ( $row['user_active'] && $row['user_actkey'] == '' )
|
||||
{
|
||||
$template->assign_vars(array(
|
||||
'META' => '<meta http-equiv="refresh" content="10;url=' . append_sid("index.$phpEx") . '">')
|
||||
'META' => '<meta http-equiv="refresh" content="10;url=index.' . $phpEx . $SID . '">')
|
||||
);
|
||||
|
||||
message_die(GENERAL_MESSAGE, $lang['Already_activated']);
|
||||
trigger_error($user->lang['Already_activated']);
|
||||
}
|
||||
else if ( $row['user_actkey'] == $HTTP_GET_VARS['act_key'] )
|
||||
else if ( $row['user_actkey'] == $_GET['act_key'] )
|
||||
{
|
||||
$sql_update_pass = ( $row['user_newpasswd'] != '' ) ? ", user_password = '" . str_replace("\'", "''", $row['user_newpasswd']) . "', user_newpasswd = ''" : '';
|
||||
|
||||
$sql = "UPDATE " . USERS_TABLE . "
|
||||
SET user_active = 1, user_actkey = ''" . $sql_update_pass . "
|
||||
WHERE user_id = " . $row['user_id'];
|
||||
if ( !($result = $db->sql_query($sql)) )
|
||||
{
|
||||
message_die(GENERAL_ERROR, 'Could not update users table', '', __LINE__, __FILE__, $sql_update);
|
||||
}
|
||||
|
||||
$result = $db->sql_query($sql);
|
||||
|
||||
if ( $config['require_activation'] == USER_ACTIVATION_ADMIN && $sql_update_pass == '' )
|
||||
{
|
||||
@@ -92,29 +74,44 @@ if ( $row = $db->sql_fetchrow($result) )
|
||||
$emailer->reset();
|
||||
|
||||
$template->assign_vars(array(
|
||||
'META' => '<meta http-equiv="refresh" content="10;url=' . append_sid("index.$phpEx") . '">')
|
||||
'META' => '<meta http-equiv="refresh" content="10;url=index.' . $phpEx . $SID . '">')
|
||||
);
|
||||
|
||||
message_die(GENERAL_MESSAGE, $lang['Account_active_admin']);
|
||||
trigger_error($user->lang['Account_active_admin']);
|
||||
}
|
||||
else
|
||||
{
|
||||
$template->assign_vars(array(
|
||||
'META' => '<meta http-equiv="refresh" content="10;url=' . append_sid("index.$phpEx") . '">')
|
||||
'META' => '<meta http-equiv="refresh" content="10;url=index.' . $phpEx . $SID . '">')
|
||||
);
|
||||
|
||||
$message = ( $sql_update_pass == '' ) ? $lang['Account_active'] : $lang['Password_activated'];
|
||||
message_die(GENERAL_MESSAGE, $message);
|
||||
$message = ( $sql_update_pass == '' ) ? $user->lang['Account_active'] : $user->lang['Password_activated'];
|
||||
trigger_error($message);
|
||||
}
|
||||
|
||||
// Sync config
|
||||
$sql = "UPDATE " . CONFIG_TABLE . "
|
||||
SET config_value = " . $row['user_id'] . "
|
||||
WHERE config_name = 'newest_user_id'";
|
||||
$db->sql_query($sql);
|
||||
$sql = "UPDATE " . CONFIG_TABLE . "
|
||||
SET config_value = '" . $row['username'] . "'
|
||||
WHERE config_name = 'newest_username'";
|
||||
$db->sql_query($sql);
|
||||
$sql = "UPDATE " . CONFIG_TABLE . "
|
||||
SET config_value = " . ($config['num_users'] + 1) . "
|
||||
WHERE config_name = 'num_users'";
|
||||
$db->sql_query($sql);
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
message_die(GENERAL_MESSAGE, $lang['Wrong_activation']);
|
||||
trigger_error($user->lang['Wrong_activation']);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
message_die(GENERAL_MESSAGE, $lang['No_such_user']);
|
||||
trigger_error($user->lang['No_such_user']);
|
||||
}
|
||||
|
||||
?>
|
||||
@@ -38,6 +38,9 @@ $error = FALSE;
|
||||
|
||||
$page_title = $user->lang['Register'];
|
||||
|
||||
// class for handling the manipulation of user data
|
||||
$userdata = new userdata();
|
||||
|
||||
if ($mode == 'register')
|
||||
{
|
||||
if(!isset($_POST['agree']) && !isset($_GET['agree']) && !isset($_POST['coppa_over_13']) && !isset($_GET['coppa_over_13']) && !isset($_POST['coppa_under_13']) && !isset($_GET['coppa_under_13']) && !$_POST['agreed'])
|
||||
@@ -66,8 +69,10 @@ $coppa = (empty($_POST['coppa_under_13']) && empty($_GET['coppa_under_13'])) ? 0
|
||||
|
||||
|
||||
// Check and initialize some variables if needed
|
||||
if (isset($_POST['submit']) || $mode == 'register')
|
||||
if (isset($_POST['submit']))
|
||||
{
|
||||
|
||||
/*
|
||||
$strip_var_list = array('username' => 'username', 'email' => 'email');
|
||||
|
||||
foreach ($strip_var_list as $var => $param)
|
||||
@@ -248,7 +253,7 @@ if (isset($_POST['submit']))
|
||||
{
|
||||
if ((($mode == 'register' || $coppa)) && ($config['require_activation'] == USER_ACTIVATION_SELF || $config['require_activation'] == USER_ACTIVATION_ADMIN))
|
||||
{
|
||||
$user_actkey = gen_rand_string(true);
|
||||
$user_actkey = gen_png_string(10);
|
||||
$key_len = 54 - (strlen($server_url));
|
||||
$key_len = ($key_len > 6) ? $key_len : 6;
|
||||
|
||||
@@ -399,6 +404,7 @@ if (isset($_POST['submit']))
|
||||
$emailer->reset();
|
||||
}
|
||||
*/
|
||||
/*
|
||||
$message = $message . '<br /><br />' . sprintf($user->lang['RETURN_INDEX'], '<a href="' . "index.$phpEx$SID" . '">', '</a>');
|
||||
|
||||
trigger_error($message);
|
||||
@@ -408,10 +414,31 @@ if (isset($_POST['submit']))
|
||||
{
|
||||
trigger_error($error_msg);
|
||||
}
|
||||
*/
|
||||
|
||||
$new_user_data = $userdata->add_new_user($_POST, $coppa);
|
||||
if($new_user_data['user_id'])
|
||||
{
|
||||
if ($config['require_activation'] == USER_ACTIVATION_NONE)
|
||||
{
|
||||
set_config('newest_user_id', $new_user_data['user_id'], TRUE);
|
||||
set_config('newest_username', $new_user_data['username'], TRUE);
|
||||
set_config('num_users', $config['num_users'] + 1, TRUE);
|
||||
}
|
||||
|
||||
trigger_error($new_user_data['message']);
|
||||
}
|
||||
else
|
||||
{
|
||||
trigger_error($new_user_data['message']);
|
||||
}
|
||||
|
||||
} // End of submit
|
||||
|
||||
|
||||
if ($error)
|
||||
|
||||
|
||||
if ($userdata->error)
|
||||
{
|
||||
//
|
||||
// If an error occured we need to stripslashes on returned data
|
||||
@@ -502,7 +529,7 @@ if ($error)
|
||||
}
|
||||
$db->sql_freeresult($result);
|
||||
|
||||
$code = gen_png_string(6);
|
||||
$code = $userdata->gen_png_string(6);
|
||||
$confirm_id = md5(uniqid($user_ip));
|
||||
|
||||
$sql = "INSERT INTO " . CONFIRM_TABLE . " (confirm_id, session_id, code)
|
||||
@@ -642,22 +669,6 @@ function show_coppa()
|
||||
);
|
||||
}
|
||||
|
||||
function gen_png_string($num_chars)
|
||||
{
|
||||
$chars = array('A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', '1', '2', '3', '4', '5', '6', '7', '8', '9');
|
||||
|
||||
list($usec, $sec) = explode(' ', microtime());
|
||||
mt_srand($sec * $usec);
|
||||
|
||||
$max_chars = count($chars) - 1;
|
||||
$rand_str = '';
|
||||
for ($i = 0; $i < $num_chars; $i++)
|
||||
{
|
||||
$rand_str .= $chars[mt_rand(0, $max_chars)];
|
||||
}
|
||||
|
||||
return $rand_str;
|
||||
}
|
||||
//
|
||||
// FUNCTIONS
|
||||
// ---------
|
||||
|
||||
Reference in New Issue
Block a user