if (isset($_POST['form_change'])) { /* password check: password is verified front end by javascript. here is to handle the errors from javascript */ if ($_POST['password_error'] != "") { $pwd_errors = explode(",", $_POST['password_error']); foreach ($pwd_errors as $pwd_error) { if ($pwd_error == "missing_password") { $missing_fields[] = _AT('password'); } else { $msg->addError($pwd_error); } } } if (!$msg->containsErrors()) { //save data $password = $addslashes($_POST['form_password_hidden']); $usersDAO->UpdateField(intval($_REQUEST['id']), 'password', $password); //send confirmation email require TR_INCLUDE_PATH . 'classes/phpmailer/transformablemailer.class.php'; $tmp_message = _AT(array('password_change_confirm', $_config['site_name'], $_base_href)) . "\n\n"; $mail = new TransformableMailer(); $mail->From = $_config['contact_email']; $mail->AddAddress($email); $mail->Subject = $_config['site_name'] . ': ' . _AT('password_forgot'); $mail->Body = $tmp_message; if (!$mail->Send()) { $msg->printErrors('SENDING_ERROR'); exit; } $msg->addFeedback('PASSWORD_CHANGED'); unset($mail); header('Location:index.php');
/************************************************************************/ /* Copyright (c) 2010 */ /* Inclusive Design Institute */ /* */ /* 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. */ /************************************************************************/ define('TR_INCLUDE_PATH', '../include/'); include TR_INCLUDE_PATH . 'vitals.inc.php'; include_once TR_INCLUDE_PATH . 'classes/DAO/UsersDAO.class.php'; if ($_POST['value'] == '') { $rtn['status'] = 'fail'; $rtn['error'][] = _AT('TR_ERROR_EMPTY_FIELD'); } if (isset($_POST['field']) && isset($_POST['value']) && $_POST['value'] != '') { $usersDAO = new UsersDAO(); // Format of $_POST['field']: [fieldName]|[user_id] $pieces = explode('-', $_POST['field']); $status = $usersDAO->UpdateField($pieces[1], $pieces[0], $_POST['value']); if (is_array($status)) { $rtn['status'] = 'fail'; foreach ($status as $err) { $rtn['error'][] = $err; } } else { $rtn['status'] = 'success'; $rtn['success'][] = _AT('TR_FEEDBACK_ACTION_COMPLETED_SUCCESSFULLY'); } } echo json_encode($rtn);