$msg->addError($pwd_error); } } } else { if (!isset($_GET['id'])) { $user_id = $usersDAO->Create($_POST['user_group_id'], $_POST['login'], $_POST['form_password_hidden'], $_POST['email'], $_POST['first_name'], $_POST['last_name'], $_POST['status']); if (is_int($user_id) && $user_id > 0) { if (defined('AC_EMAIL_CONFIRMATION') && AC_EMAIL_CONFIRMATION) { $msg->addFeedback('REG_THANKS_CONFIRM'); $code = substr(md5($_POST['email'] . $now . $user_id), 0, 10); $confirmation_link = $_base_href . 'confirm.php?id=' . $user_id . SEP . 'm=' . $code; /* send the email confirmation message: */ require AC_INCLUDE_PATH . 'classes/phpmailer/acheckermailer.class.php'; $mail = new ACheckerMailer(); $mail->From = $_config['contact_email']; $mail->AddAddress($_POST['email']); $mail->Subject = SITE_NAME . ' - ' . _AC('email_confirmation_subject'); $mail->Body = _AC('email_confirmation_message', SITE_NAME, $confirmation_link) . "\n\n"; $mail->Send(); } else { $msg->addFeedback('ACTION_COMPLETED_SUCCESSFULLY'); header('Location: index.php'); exit; } } } else { if ($usersDAO->Update($_GET['id'], $_POST['user_group_id'], $_POST['login'], $_POST['email'], $_POST['first_name'], $_POST['last_name'], $_POST['status'])) { $msg->addFeedback('ACTION_COMPLETED_SUCCESSFULLY'); header('Location: index.php'); exit; }
$msg->addError('CONFIRM_BAD'); } } else { if (isset($_POST['submit'])) { $_POST['email'] = $addslashes($_POST['email']); $usersDAO = new UsersDAO(); $row = $usersDAO->getUserByEmail($_POST['email']); if ($row) { if ($row['status'] == AC_STATUS_UNCONFIRMED) { $code = substr(md5($row['email'] . $row['creation_date'] . $row['user_id']), 0, 10); $confirmation_link = $_base_href . 'confirm.php?id=' . $row['user_id'] . SEP . 'm=' . $code; /* send the email confirmation message: */ require AC_INCLUDE_PATH . 'classes/phpmailer/acheckermailer.class.php'; $mail = new ACheckerMailer(); $mail->From = $_config['contact_email']; $mail->AddAddress($row['email']); $mail->Subject = SITE_NAME . ': ' . _AC('email_confirmation_subject'); $mail->Body = _AC('email_confirmation_message', $_base_href, $confirmation_link) . "\n\n"; $mail->Send(); $msg->addFeedback('CONFIRMATION_SENT'); } else { $msg->addFeedback('ACCOUNT_CONFIRMED'); } header('Location: ' . $_base_href . 'login.php'); exit; } else { $msg->addError('EMAIL_NOT_FOUND'); } } } }
// insert into the db. $password = $addslashes($_POST['form_password_hidden']); $usersDAO = new UsersDAO(); if (!$usersDAO->setPassword($_GET['id'], $password)) { require AC_INCLUDE_PATH . 'header.inc.php'; $msg->printErrors('DB_NOT_UPDATED'); require AC_INCLUDE_PATH . 'footer.inc.php'; exit; } // send email to user $user_row = $usersDAO->getUserByID($_GET['id']); $tmp_message = _AC('password_change_msg') . "\n\n"; $tmp_message .= _AC('web_site') . ' : ' . AC_BASE_HREF . "\n"; $tmp_message .= _AC('login_name') . ' : ' . $user_row['login'] . "\n"; require AC_INCLUDE_PATH . 'classes/phpmailer/acheckermailer.class.php'; $mail = new ACheckerMailer(); $mail->From = $_config['contact_email']; $mail->AddAddress($user_row['email']); $mail->Subject = $_config['site_name'] . ': ' . _AC('password_changed'); $mail->Body = $tmp_message; if (!$mail->Send()) { $msg->addError('SENDING_ERROR'); } else { $msg->addFeedback('ACTION_COMPLETED_SUCCESSFULLY'); } header('Location: index.php'); exit; } } /* template starts here */ $savant->display('user/user_password.tmpl.php');
$missing_fields[] = _AC('password'); } else { $msg->addError($pwd_error); } } } if (!$msg->containsErrors()) { //save data $password = $addslashes($_POST['form_password_hidden']); $usersDAO->setPassword(intval($_REQUEST['id']), $password); //send confirmation email require AC_INCLUDE_PATH . 'classes/phpmailer/acheckermailer.class.php'; $tmp_message = _AC(array('password_change_confirm', $_config['site_name'], $_base_href)) . "\n\n"; $mail = new ACheckerMailer(); $mail->From = $_config['contact_email']; $mail->AddAddress($email); $mail->Subject = $_config['site_name'] . ': ' . _AC('password_forgot'); $mail->Body = $tmp_message; if (!$mail->Send()) { $msg->printErrors('SENDING_ERROR'); exit; } $msg->addFeedback('PASSWORD_CHANGED'); unset($mail); header('Location:index.php'); } else { $savant->assign('id', $_REQUEST['id']); $savant->assign('g', $_REQUEST['g']); $savant->assign('h', $_REQUEST['h']); $savant->display('change_password.tmpl.php'); }