function subscrAddRegisteredCustomerEmail($customerID) { $q = db_query("select Email from " . CUSTOMERS_TABLE . " where customerID=" . (int) $customerID); $customer = db_fetch_row($q); if ($customer) { db_query("update " . CUSTOMERS_TABLE . " set subscribed4news=1 where customerID=" . (int) $customerID); if (_subscriberIsSubscribed($customer["Email"])) { db_query("update " . MAILING_LIST_TABLE . " set customerID=" . (int) $customerID . " where Email='" . xToText($customer["Email"]) . "'"); } else { db_query("insert into " . MAILING_LIST_TABLE . " ( Email, customerID ) " . " values( '" . xToText($customer["Email"]) . "', " . (int) $customerID . " ) "); } } }
<?php $news_array = newsGetNewsToCustomer(); $smarty->assign("news_array", $news_array); $pre_news_array = newsGetPreNewsToCustomer(); $smarty->assign("pre_news_array", $pre_news_array); if (isset($_POST['subscribe_email'])) { $subscribe_email = trim($_POST['subscribe_email']); $check_email = subscrVerifyEmailAddress($subscribe_email); if ($check_email) { if (isset($_POST['subscribe_mode'])) { $subscribe_mode = (int) $_POST['subscribe_mode']; } switch ($subscribe_mode) { case 0: if (_subscriberIsSubscribed($subscribe_email)) { subscrUnsubscribeSubscriberByEmail2($subscribe_email); $smarty->assign("unsubscribe", 1); } else { $smarty->assign("unsubscribe", 2); } break; case 1: subscrAddUnRegisteredCustomerEmail($subscribe_email); $smarty->assign("subscribe", 1); break; } } else { $smarty->assign("subscribe_error", ERROR_INPUT_EMAIL); } $smarty->assign("main_content_template", "subscribe.tpl");