} 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; } } } }
// 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');