2003-05-19 15:23:04 +00:00
|
|
|
<?php
|
2005-04-09 12:26:45 +00:00
|
|
|
/**
|
|
|
|
*
|
|
|
|
* @package ucp
|
|
|
|
* @version $Id$
|
|
|
|
* @copyright (c) 2005 phpBB Group
|
|
|
|
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* ucp_remind
|
|
|
|
* Sending password reminders
|
2006-06-13 21:06:29 +00:00
|
|
|
* @package ucp
|
2005-04-09 12:26:45 +00:00
|
|
|
*/
|
2005-10-04 21:31:35 +00:00
|
|
|
class ucp_remind
|
2003-05-19 15:23:04 +00:00
|
|
|
{
|
2006-06-06 20:53:46 +00:00
|
|
|
var $u_action;
|
|
|
|
|
2005-10-04 21:31:35 +00:00
|
|
|
function main($id, $mode)
|
2003-05-19 15:23:04 +00:00
|
|
|
{
|
2006-06-11 18:13:52 +00:00
|
|
|
global $config, $phpbb_root_path, $phpEx;
|
|
|
|
global $db, $user, $auth, $template;
|
2003-05-19 15:23:04 +00:00
|
|
|
|
- renamed the following columns:
comment -> attach_comment
new, forwarded, unread, marked, deleted -> pm_new, pm_forwarded, pm_unread, pm_marked, pm_deleted
module_name -> module_basename
value -> lang_value
- every column is now NOT NULL
- every column is now having a DEFAULT value
- hopefully mostly consistent across every db schema
- untested schemas: sqlite, oracle, firebird
git-svn-id: file:///svn/phpbb/trunk@6177 89ea8834-ac86-4346-8a33-228a782c2dd0
2006-07-13 12:51:56 +00:00
|
|
|
$username = request_var('username', '');
|
2006-06-11 18:13:52 +00:00
|
|
|
$email = request_var('email', '');
|
|
|
|
$submit = (isset($_POST['submit'])) ? true : false;
|
2003-10-12 11:59:23 +00:00
|
|
|
|
|
|
|
if ($submit)
|
2003-05-19 15:23:04 +00:00
|
|
|
{
|
2003-10-15 17:43:07 +00:00
|
|
|
$sql = 'SELECT user_id, username, user_email, user_jabber, user_notify_type, user_type, user_lang
|
2003-09-08 12:42:32 +00:00
|
|
|
FROM ' . USERS_TABLE . "
|
2003-05-19 15:23:04 +00:00
|
|
|
WHERE user_email = '" . $db->sql_escape($email) . "'
|
2006-10-07 12:36:31 +00:00
|
|
|
AND LOWER(username) = '" . $db->sql_escape(utf8_strtolower($username)) . "'";
|
2004-10-13 19:30:02 +00:00
|
|
|
$result = $db->sql_query($sql);
|
2006-06-11 18:13:52 +00:00
|
|
|
$user_row = $db->sql_fetchrow($result);
|
|
|
|
$db->sql_freeresult($result);
|
2003-10-12 15:29:18 +00:00
|
|
|
|
2006-06-11 18:13:52 +00:00
|
|
|
if (!$user_row)
|
2003-05-19 15:23:04 +00:00
|
|
|
{
|
2004-10-13 19:30:02 +00:00
|
|
|
trigger_error('NO_EMAIL_USER');
|
2003-05-19 15:23:04 +00:00
|
|
|
}
|
2003-10-12 15:29:18 +00:00
|
|
|
|
2006-06-11 18:13:52 +00:00
|
|
|
if ($user_row['user_type'] == USER_INACTIVE)
|
2003-10-12 15:29:18 +00:00
|
|
|
{
|
2004-10-13 19:30:02 +00:00
|
|
|
trigger_error('ACCOUNT_NOT_ACTIVATED');
|
2003-10-12 15:29:18 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
$server_url = generate_board_url();
|
|
|
|
|
|
|
|
$key_len = 54 - strlen($server_url);
|
2006-06-11 18:13:52 +00:00
|
|
|
$key_len = ($key_len < 6) ? 6 : $key_len;
|
2003-10-12 15:29:18 +00:00
|
|
|
$user_actkey = substr(gen_rand_string(10), 0, $key_len);
|
|
|
|
$user_password = gen_rand_string(8);
|
|
|
|
|
|
|
|
$sql = 'UPDATE ' . USERS_TABLE . "
|
|
|
|
SET user_newpasswd = '" . $db->sql_escape(md5($user_password)) . "', user_actkey = '" . $db->sql_escape($user_actkey) . "'
|
2006-06-11 18:13:52 +00:00
|
|
|
WHERE user_id = " . $user_row['user_id'];
|
2003-10-12 15:29:18 +00:00
|
|
|
$db->sql_query($sql);
|
|
|
|
|
2006-06-11 18:13:52 +00:00
|
|
|
include_once($phpbb_root_path . 'includes/functions_messenger.' . $phpEx);
|
2003-10-12 15:29:18 +00:00
|
|
|
|
2006-06-11 18:13:52 +00:00
|
|
|
$messenger = new messenger(false);
|
2003-10-12 15:29:18 +00:00
|
|
|
|
2006-06-20 19:00:30 +00:00
|
|
|
$messenger->template('user_activate_passwd', $user_row['user_lang']);
|
2003-10-12 15:29:18 +00:00
|
|
|
|
|
|
|
$messenger->replyto($user->data['user_email']);
|
2006-06-11 18:13:52 +00:00
|
|
|
$messenger->to($user_row['user_email'], $user_row['username']);
|
|
|
|
$messenger->im($user_row['user_jabber'], $user_row['username']);
|
2003-10-12 15:29:18 +00:00
|
|
|
|
|
|
|
$messenger->assign_vars(array(
|
|
|
|
'SITENAME' => $config['sitename'],
|
2006-06-11 18:13:52 +00:00
|
|
|
'USERNAME' => html_entity_decode($user_row['username']),
|
2006-05-20 18:39:35 +00:00
|
|
|
'PASSWORD' => html_entity_decode($user_password),
|
2003-10-12 15:29:18 +00:00
|
|
|
'EMAIL_SIG' => str_replace('<br />', "\n", "-- \n" . $config['board_email_sig']),
|
|
|
|
|
2006-06-11 18:13:52 +00:00
|
|
|
'U_ACTIVATE' => "$server_url/ucp.$phpEx?mode=activate&u={$user_row['user_id']}&k=$user_actkey")
|
2003-10-12 15:29:18 +00:00
|
|
|
);
|
|
|
|
|
2006-06-11 18:13:52 +00:00
|
|
|
$messenger->send($user_row['user_notify_type']);
|
2003-10-12 15:29:18 +00:00
|
|
|
|
2006-06-06 20:53:46 +00:00
|
|
|
meta_refresh(3, append_sid("{$phpbb_root_path}index.$phpEx"));
|
2003-10-12 15:29:18 +00:00
|
|
|
|
2006-06-06 20:53:46 +00:00
|
|
|
$message = $user->lang['PASSWORD_UPDATED'] . '<br /><br />' . sprintf($user->lang['RETURN_INDEX'], '<a href="' . append_sid("{$phpbb_root_path}index.$phpEx") . '">', '</a>');
|
2003-10-12 15:29:18 +00:00
|
|
|
trigger_error($message);
|
2003-05-19 15:23:04 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
$template->assign_vars(array(
|
2006-06-11 18:13:52 +00:00
|
|
|
'USERNAME' => $username,
|
|
|
|
'EMAIL' => $email,
|
|
|
|
'S_PROFILE_ACTION' => append_sid($phpbb_root_path . 'ucp.' . $phpEx, 'mode=sendpassword'))
|
2003-05-19 15:23:04 +00:00
|
|
|
);
|
2003-10-12 15:29:18 +00:00
|
|
|
|
2005-10-04 21:31:35 +00:00
|
|
|
$this->tpl_name = 'ucp_remind';
|
2006-06-12 22:16:27 +00:00
|
|
|
$this->page_title = 'UCP_REMIND';
|
2003-05-19 15:23:04 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2006-06-11 18:13:52 +00:00
|
|
|
?>
|