Account Password.php:
<?php
/*
$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
Enterprise Shopping Cart
http://www.enterprisecart.com
Copyright (c) 2004 Enterprise Shopping Cart Software. Portions Copyright (c) 2001-2004 osCommerce: http://www.oscommerce.com
Released under the GNU General Public License
*/
require('includes/application_top.php');
if (!escs_session_is_registered('customer_id')) {
$navigation->set_snapshot();
escs_redirect(escs_href_link(FILENAME_LOGIN, '', 'SSL'));
}
// needs to be included earlier to set the success message in the messageStack
require(DIR_WS_LANGUAGES . $language . '/' . FILENAME_ACCOUNT_PASSWORD);
if (isset($HTTP_POST_VARS['action']) && ($HTTP_POST_VARS['action'] == 'process')) {
$password_current = escs_db_prepare_input($HTTP_POST_VARS['password_current']);
$password_new = escs_db_prepare_input($HTTP_POST_VARS['password_new']);
$password_confirmation = escs_db_prepare_input($HTTP_POST_VARS['password_confirmation']);
$error = false;
if (strlen($password_current) < ENTRY_PASSWORD_MIN_LENGTH) {
$error = true;
$messageStack->add('account_password', ENTRY_PASSWORD_CURRENT_ERROR);
} elseif (strlen($password_new) < ENTRY_PASSWORD_MIN_LENGTH) {
$error = true;
$messageStack->add('account_password', ENTRY_PASSWORD_NEW_ERROR);
} elseif ($password_new != $password_confirmation) {
$error = true;
$messageStack->add('account_password', ENTRY_PASSWORD_NEW_ERROR_NOT_MATCHING);
}
if ($error == false) {
$check_customer_query = escs_db_query("select customers_password from " . TABLE_CUSTOMERS . " where customers_id = '" . (int)$customer_id . "'");
$check_customer = escs_db_fetch_array($check_customer_query);
if (escs_validate_password($password_current, $check_customer['customers_password'])) {
escs_db_query("update " . TABLE_CUSTOMERS . " set customers_password = '" . escs_encrypt_password($password_new) . "' where customers_id = '" . (int)$customer_id . "'");
escs_db_query("update " . TABLE_CUSTOMERS_INFO . " set customers_info_date_account_last_modified = now() where customers_info_id = '" . (int)$customer_id . "'");
$messageStack->add_session('account', SUCCESS_PASSWORD_UPDATED, 'success');
escs_redirect(escs_href_link(FILENAME_ACCOUNT, '', 'SSL'));
} else {
$error = true;
$messageStack->add('account_password', ERROR_CURRENT_PASSWORD_NOT_MATCHING);
}
}
}
$breadcrumb->add(NAVBAR_TITLE_1, escs_href_link(FILENAME_ACCOUNT, '', 'SSL'));
$breadcrumb->add(NAVBAR_TITLE_2, escs_href_link(FILENAME_ACCOUNT_PASSWORD, '', 'SSL'));
$content = CONTENT_ACCOUNT_PASSWORD;
$javascript = 'form_check.js.php';
require(DIR_WS_TEMPLATES . TEMPLATENAME_MAIN_PAGE);
require(DIR_WS_INCLUDES . 'application_bottom.php');
?>
Other E Commerce Scripts: