Account Notifications.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_NOTIFICATIONS);
$global_query = escs_db_query("select global_product_notifications from " . TABLE_CUSTOMERS_INFO . " where customers_info_id = '" . (int)$customer_id . "'");
$global = escs_db_fetch_array($global_query);
if (isset($HTTP_POST_VARS['action']) && ($HTTP_POST_VARS['action'] == 'process')) {
if (isset($HTTP_POST_VARS['product_global']) && is_numeric($HTTP_POST_VARS['product_global'])) {
$product_global = escs_db_prepare_input($HTTP_POST_VARS['product_global']);
} else {
$product_global = '0';
}
(array)$products = $HTTP_POST_VARS['products'];
if ($product_global != $global['global_product_notifications']) {
$product_global = (($global['global_product_notifications'] == '1') ? '0' : '1');
escs_db_query("update " . TABLE_CUSTOMERS_INFO . " set global_product_notifications = '" . (int)$product_global . "' where customers_info_id = '" . (int)$customer_id . "'");
} elseif (sizeof($products) > 0) {
$products_parsed = array();
for ($i=0, $n=sizeof($products); $i<$n; $i++) {
if (is_numeric($products[$i])) {
$products_parsed[] = $products[$i];
}
}
if (sizeof($products_parsed) > 0) {
$check_query = escs_db_query("select count(*) as total from " . TABLE_PRODUCTS_NOTIFICATIONS . " where customers_id = '" . (int)$customer_id . "' and products_id not in (" . implode(', ', $products_parsed) . ")");
$check = escs_db_fetch_array($check_query);
if ($check['total'] > 0) {
escs_db_query("delete from " . TABLE_PRODUCTS_NOTIFICATIONS . " where customers_id = '" . (int)$customer_id . "' and products_id not in (" . implode(', ', $products_parsed) . ")");
}
}
} else {
$check_query = escs_db_query("select count(*) as total from " . TABLE_PRODUCTS_NOTIFICATIONS . " where customers_id = '" . (int)$customer_id . "'");
$check = escs_db_fetch_array($check_query);
if ($check['total'] > 0) {
escs_db_query("delete from " . TABLE_PRODUCTS_NOTIFICATIONS . " where customers_id = '" . (int)$customer_id . "'");
}
}
$messageStack->add_session('account', SUCCESS_NOTIFICATIONS_UPDATED, 'success');
escs_redirect(escs_href_link(FILENAME_ACCOUNT, '', 'SSL'));
}
$breadcrumb->add(NAVBAR_TITLE_1, escs_href_link(FILENAME_ACCOUNT, '', 'SSL'));
$breadcrumb->add(NAVBAR_TITLE_2, escs_href_link(FILENAME_ACCOUNT_NOTIFICATIONS, '', 'SSL'));
$content = CONTENT_ACCOUNT_NOTIFICATIONS;
$javascript = $content . '.js';
require(DIR_WS_TEMPLATES . TEMPLATENAME_MAIN_PAGE);
require(DIR_WS_INCLUDES . 'application_bottom.php');
?>
Other E Commerce Scripts: