function user_login($email_address)
 {
     global $order, $customer_id, $customer_default_address_id, $customer_first_name, $customer_country_id, $customer_zone_id;
     /*
     This allows the user to login with only a valid email (the email address sent back by PayPal)
     Their PayPal payerID is stored in the database, but I still don't know if that number changes.
     If it doesn't, it could be used to
     help identify an existing customer who hasn't logged in.  Until I know for sure, the email address is enough
     */
     global $session_started, $language, $cart;
     if ($session_started == false) {
         olc_redirect(olc_href_link(FILENAME_COOKIE_USAGE));
     }
     require DIR_WS_LANGUAGES . SESSION_LANGUAGE . SLASH . FILENAME_LOGIN;
     $check_customer_query = olc_db_query("select customers_id, customers_firstname, customers_password,\n\t\tcustomers_email_address, customers_default_address_id, customers_paypal_payerid from " . TABLE_CUSTOMERS . " where customers_email_address = '" . olc_db_input($email_address) . APOS);
     $check_customer = olc_db_fetch_array($check_customer_query);
     if (!olc_db_num_rows($check_customer_query)) {
         $this->away_with_you(MODULE_PAYMENT_PAYPAL_DP_TEXT_BAD_LOGIN, true);
     } else {
         if (SESSION_RECREATE == TRUE_STRING_S) {
             olc_session_recreate();
         }
         $check_country_query = olc_db_query("select entry_country_id, entry_zone_id from " . TABLE_ADDRESS_BOOK . " where customers_id = '" . (int) $check_customer['customers_id'] . "' and address_book_id = '" . (int) $check_customer['customers_default_address_id'] . APOS);
         $check_country = olc_db_fetch_array($check_country_query);
         $customer_id = $check_customer['customers_id'];
         $customer_default_address_id = $check_customer['customers_default_address_id'];
         $customer_first_name = $check_customer['customers_firstname'];
         $customer_country_id = $check_country['entry_country_id'];
         $customer_zone_id = $check_country['entry_zone_id'];
         $_SESSION['customer_id'];
         $_SESSION['customer_default_address_id'];
         $_SESSION['customer_first_name'];
         $_SESSION['customer_country_id'];
         $_SESSION['customer_zone_id'];
         $order->customer['id'] = $customer_id;
         olc_db_query(SQL_UPDATE . TABLE_CUSTOMERS_INFO . " set\n\t\t\tcustomers_info_date_of_last_logon = now(),\n\t\t\tcustomers_info_number_of_logons = customers_info_number_of_logons+1\n\t\t\twhere customers_info_id = '" . (int) $customer_id . APOS);
         $cart->restore_contents();
         $this->away_with_you();
     }
 }
        */
        olc_db_query(DELETE_FROM . TABLE_BLACKLIST . " where blacklist_id = '" . olc_db_input($blacklist_id) . APOS);
        //      olc_db_query(DELETE_FROM . TABLE_MANUFACTURERS_INFO . " where manufacturers_id = '" . olc_db_input($manufacturers_id) . APOS);
        /*      if ($_POST['delete_products'] == 'on') {
                $products_query = olc_db_query("select products_id from " . TABLE_PRODUCTS . " where manufacturers_id = '" . olc_db_input($manufacturers_id) . APOS);
                while ($products = olc_db_fetch_array($products_query)) {
                  olc_remove_product($products['products_id']);
                }
              } else {
                olc_db_query(SQL_UPDATE . TABLE_PRODUCTS . " set manufacturers_id = '' where manufacturers_id = '" . olc_db_input($manufacturers_id) . APOS);
              }
        */
        if (USE_CACHE == TRUE_STRING_S) {
            olc_reset_cache_block('manufacturers');
        }
        olc_redirect(olc_href_link(FILENAME_BLACKLIST, 'page=' . $_GET['page']));
        break;
}
require DIR_WS_INCLUDES . 'header.php';
?>
<table border="0" width="100%" cellspacing="2" cellpadding="2">
  <tr>
    <td class="columnLeft2" nowrap="nowrap" valign="top"><table border="0" cellspacing="1" cellpadding="1" class="columnLeft" nowrap="nowrap">
<!-- left_navigation //-->
<?php 
require DIR_WS_INCLUDES . 'column_left.php';
?>
<!-- left_navigation_eof //-->
    </table></td>
<!-- body_text //-->
    <td width="100%" valign="top"><table border="0" width="100%" cellspacing="0" cellpadding="2">
(c) 2000-2001 The Exchange Project  (earlier name of osCommerce)
(c) 2002-2003 osCommerce(customers.php,v 1.76 2003/05/04); www.oscommerce.com
(c) 2003	    nextcommerce (customers.php,v 1.22 2003/08/24); www.nextcommerce.org
(c) 2004      XT - Commerce; www.xt-commerce.com

Released under the GNU General Public License
--------------------------------------------------------------
Third Party contribution:
Customers Status v3.x  (c) 2002-2003 Copyright Elari elari@free.fr | www.unlockgsm.com/dload-osc/ | CVS : http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/elari/?sortby=date#dirlist

Released under the GNU General Public License
--------------------------------------------------------------*/
// if the customer is not logged on, redirect them to the login page
require 'includes/application_top.php';
if (!isset($_SESSION['customer_id'])) {
    olc_redirect(olc_href_link(FILENAME_LOGIN, EMPTY_STRING, NONSSL));
}
include DIR_WS_INCLUDES . 'html_head_full.php';
$button_back = HTML_A_START . olc_href_link(FILENAME_START, EMPTY_STRING, NONSSL) . '">' . olc_template_image_button('button_back.gif', 'Zurück zur Startseite') . HTML_A_END;
$checkstatus = !$_GET['ignorestatus'];
if ($checkstatus && !isset($_POST["submitted"])) {
    $main_content = EMPTY_STRING;
    $err_message = $_GET['err_message'];
    if ($err_message != EMPTY_STRING) {
        $main_content .= '<p><b><font color="red">' . $err_message . "</font></b></p>";
    }
    $main_content .= '<input type="hidden" name="submitted" value="TRUE" id="' . time() . '">';
    $main_content .= HTML_BR . '<input type="file" name="file" size="50">' . HTML_BR;
    $smarty->assign('FORM_ACTION', olc_draw_form('blz_update', $PHP_SELF, 'full=1', 'post', 'enctype="multipart/form-data"'));
    $smarty->assign('BUTTON_CONTINUE', olc_template_image_submit('button_continue.gif', IMAGE_BUTTON_CONTINUE));
    $smarty->assign('SHOW_EXPLANATION', "1");
            $coupon_code = create_coupon_code();
            $insert_query = olc_db_query(INSERT_INTO . TABLE_COUPONS . " (coupon_code, coupon_type, coupon_amount, date_created) values ('" . $coupon_code . "', 'G', '" . NEW_SIGNUP_GIFT_VOUCHER_AMOUNT . "', now())");
            $insert_id = olc_db_insert_id($insert_query);
            $insert_query = olc_db_query(INSERT_INTO . TABLE_COUPON_EMAIL_TRACK . " (coupon_id, customer_id_sent, sent_firstname, emailed_to, date_sent) values ('" . $insert_id . "', '0', 'Admin', '" . $customers_email_address . "', now() )");
            $html_mail .= '<br/><br/>' . sprintf(EMAIL_GV_INCENTIVE_HEADER, $currencies->format(NEW_SIGNUP_GIFT_VOUCHER_AMOUNT)) . "<br/><br/>" . sprintf(EMAIL_GV_REDEEM, $coupon_code) . "<br/><br/>" . EMAIL_GV_LINK . olc_href_link(FILENAME_GV_REDEEM, 'gv_no=' . $coupon_code, NONSSL, false) . "<br/><br/>";
            $txt_mail .= "\n\n" . sprintf(EMAIL_GV_INCENTIVE_HEADER, $currencies->format(NEW_SIGNUP_GIFT_VOUCHER_AMOUNT)) . "\n\n" . sprintf(EMAIL_GV_REDEEM, $coupon_code) . "\n\n" . EMAIL_GV_LINK . olc_href_link(FILENAME_GV_REDEEM, 'gv_no=' . $coupon_code, NONSSL, false) . "\n\n";
        }
        if (NEW_SIGNUP_DISCOUNT_COUPON != '') {
            $coupon_code = NEW_SIGNUP_DISCOUNT_COUPON;
            $coupon_query = olc_db_query("select * from " . TABLE_COUPONS . " where coupon_code = '" . $coupon_code . APOS);
            $coupon = olc_db_fetch_array($coupon_query);
            $coupon_id = $coupon['coupon_id'];
            $coupon_desc_query = olc_db_query("select * from " . TABLE_COUPONS_DESCRIPTION . " where coupon_id = '" . $coupon_id . "' and language_id = '" . (int) $_SESSION['languages_id'] . APOS);
            $coupon_desc = olc_db_fetch_array($coupon_desc_query);
            $insert_query = olc_db_query(INSERT_INTO . TABLE_COUPON_EMAIL_TRACK . " (coupon_id, customer_id_sent, sent_firstname, emailed_to, date_sent) values ('" . $coupon_id . "', '0', 'Admin', '" . $customers_email_address . "', now() )");
            $html_mail .= "<br/><br/>" . EMAIL_COUPON_INCENTIVE_HEADER . HTML_BR . sprintf("%s", $coupon_desc['coupon_description']) . "<br/><br/>" . sprintf(EMAIL_COUPON_REDEEM, $coupon['coupon_code']) . "<br/><br/>" . "<br/><br/>";
            $txt_mail .= "\n\n" . EMAIL_COUPON_INCENTIVE_HEADER . NEW_LINE . sprintf("%s", $coupon_desc['coupon_description']) . "\n\n" . sprintf(EMAIL_COUPON_REDEEM, $coupon['coupon_code']) . "\n\n" . "\n\n";
        }
        // ICW - CREDIT CLASS CODE BLOCK ADDED  ******************************************************* END
        // GV Code End
        //	W. Kaiser - eMail-type by customer
        olc_php_mail(EMAIL_SUPPORT_ADDRESS, EMAIL_SUPPORT_NAME, $customers_email_address, $name, EMAIL_SUPPORT_FORWARDING_STRING, EMAIL_SUPPORT_REPLY_ADDRESS, EMAIL_SUPPORT_REPLY_ADDRESS_NAME, '', '', EMAIL_SUPPORT_SUBJECT, $html_mail, $txt_mail, $customers_email_type);
        //	W. Kaiser - eMail-type by customer
        if (!isset($mail_error)) {
            olc_redirect(olc_href_link(FILENAME_SHOPPING_CART));
        }
    }
}
//	W. Kaiser - Common code for "create_account.php" and "customers.php"
include DIR_FS_INC . 'olc_show_customer_data_form.inc.php';
//	W. Kaiser - Common code for "create_account.php" and "customers.php"
    if ($finished) {
        // finished
        $limit1_query = olc_db_query("SELECT count(*) as count" . $temp_table_from . " WHERE comment='send'");
        $limit1_data = olc_db_fetch_array($limit1_query);
        if ($limit1_data['count'] - $limit_data['count'] <= 0) {
            olc_db_query(SQL_UPDATE . TABLE_MODULE_NEWSLETTER . " SET status='1' WHERE newsletter_id='" . $id_get . APOS);
            olc_redirect(olc_href_link(FILENAME_MODULE_NEWSLETTER));
        } else {
            $count = $limit1_data['count'];
            echo HTML_B_START . $count . '<b> eMails verschickt<br/>';
            echo HTML_B_START . $count - $limit_data['count'] . '<b> eMails übrig';
        }
    } else {
        $limit_low = $limit_high + 1;
        $limit_high = $limit_low + EMAIL_NEWSLETTER_PACAKGE_SIZE;
        olc_redirect(olc_href_link(FILENAME_MODULE_NEWSLETTER, 'send=' . $limit_low . COMMA . $limit_high . '&id=' . $id_get));
    }
}
require DIR_WS_INCLUDES . 'header.php';
?>
<table border="0" width="100%" cellspacing="2" cellpadding="2">
  <tr>
    <td class="columnLeft2" nowrap="nowrap" valign="top">
    	<table border="0" cellspacing="1" cellpadding="1" class="columnLeft" nowrap="nowrap">
				<!-- left_navigation //-->
				<?php 
require DIR_WS_INCLUDES . 'column_left.php';
?>
				<!-- left_navigation_eof //-->
	    </table>
	   </td>
            $date_added = olc_db_prepare_input($_POST['date_added']);
            olc_db_query(INSERT_INTO . TABLE_TAX_CLASS . " (tax_class_title, tax_class_description, date_added) values ('" . olc_db_input($tax_class_title) . "', '" . olc_db_input($tax_class_description) . "', now())");
            olc_redirect(olc_href_link(FILENAME_TAX_CLASSES));
            break;
        case 'save':
            $tax_class_id = olc_db_prepare_input($_GET['tID']);
            $tax_class_title = olc_db_prepare_input($_POST['tax_class_title']);
            $tax_class_description = olc_db_prepare_input($_POST['tax_class_description']);
            $last_modified = olc_db_prepare_input($_POST['last_modified']);
            olc_db_query(SQL_UPDATE . TABLE_TAX_CLASS . " set tax_class_id = '" . olc_db_input($tax_class_id) . "', tax_class_title = '" . olc_db_input($tax_class_title) . "', tax_class_description = '" . olc_db_input($tax_class_description) . "', last_modified = now() where tax_class_id = '" . olc_db_input($tax_class_id) . APOS);
            olc_redirect(olc_href_link(FILENAME_TAX_CLASSES, 'page=' . $_GET['page'] . '&tID=' . $tax_class_id));
            break;
        case 'deleteconfirm':
            $tax_class_id = olc_db_prepare_input($_GET['tID']);
            olc_db_query(DELETE_FROM . TABLE_TAX_CLASS . " where tax_class_id = '" . olc_db_input($tax_class_id) . APOS);
            olc_redirect(olc_href_link(FILENAME_TAX_CLASSES, 'page=' . $_GET['page']));
            break;
    }
}
require DIR_WS_INCLUDES . 'header.php';
?>
<table border="0" width="100%" cellspacing="2" cellpadding="2">
  <tr>
    <td class="columnLeft2" nowrap="nowrap" valign="top"><table border="0" cellspacing="1" cellpadding="1" class="columnLeft" nowrap="nowrap">
<!-- left_navigation //-->
<?php 
require DIR_WS_INCLUDES . 'column_left.php';
?>
<!-- left_navigation_eof //-->
    </table></td>
<!-- body_text //-->
    $message = olc_db_prepare_input($_POST['message']);
    // Instantiate a new mail object
    $mimemessage = new email(array('X-Mailer: OLC mailer'));
    // Build the text version
    $text = strip_tags($text);
    if (EMAIL_USE_HTML == TRUE_STRING_S) {
        $mimemessage->add_html($message);
    } else {
        $mimemessage->add_text($message);
    }
    // Send message
    $mimemessage->build_message();
    while ($mail = olc_db_fetch_array($mail_query)) {
        $mimemessage->send($mail['affiliate_firstname'] . BLANK . $mail['affiliate_lastname'], $mail['affiliate_email_address'], '', $from, $subject);
    }
    olc_redirect(olc_href_link(FILENAME_AFFILIATE_CONTACT, 'mail_sent_to=' . urlencode($mail_sent_to)));
}
if ($_GET['action'] == 'preview' && !$_POST['affiliate_email_address']) {
    $messageStack->add(ERROR_NO_AFFILIATE_SELECTED, 'error');
}
if (olc_not_null($_GET['mail_sent_to'])) {
    $messageStack->add(sprintf(NOTICE_EMAIL_SENT_TO, $_GET['mail_sent_to']), 'notice');
}
require DIR_WS_INCLUDES . 'header.php';
?>
<table border="0" width="100%" cellspacing="2" cellpadding="2">
  <tr>
    <td class="columnLeft2" nowrap="nowrap" valign="top"><table border="0" cellspacing="1" cellpadding="1" class="columnLeft" nowrap="nowrap">
<!-- left_navigation //-->
<?php 
require DIR_WS_INCLUDES . 'column_left.php';
     } else {
         olc_db_query(SQL_UPDATE . TABLE_REVIEWS . " set customers_id = null" . $where_customers_id);
     }
     olc_db_query(DELETE_FROM . TABLE_ADDRESS_BOOK . $where_customers_id);
     olc_db_query(DELETE_FROM . TABLE_CUSTOMERS . $where_customers_id);
     olc_db_query(DELETE_FROM . TABLE_CUSTOMERS_INFO . " where customers_info_id" . $customers_id_db);
     olc_db_query(DELETE_FROM . TABLE_CUSTOMERS_BASKET . $where_customers_id);
     olc_db_query(DELETE_FROM . TABLE_CUSTOMERS_BASKET_ATTRIBUTES . $where_customers_id);
     olc_db_query(DELETE_FROM . TABLE_PRODUCTS_NOTIFICATIONS . $where_customers_id);
     olc_db_query(DELETE_FROM . TABLE_WHOS_ONLINE . $where_customers_id_1);
     olc_db_query(DELETE_FROM . TABLE_CUSTOMERS_STATUS_HISTORY . $where_customers_id);
     olc_db_query(DELETE_FROM . TABLE_CUSTOMERS_IP . $where_customers_id);
     olc_db_query(DELETE_FROM . TABLE_CUSTOMERS_BASKET_SAVE_BASKETS . $where_customers_id);
     olc_db_query(DELETE_FROM . TABLE_CUSTOMERS_BASKET_SAVE . $where_customers_id);
     olc_db_query(DELETE_FROM . TABLE_CUSTOMERS_BASKET_ATTRIBUTES . $where_customers_id);
     olc_redirect(olc_href_link(FILENAME_CUSTOMERS, olc_get_all_get_params(array('cID', 'action'))));
     break;
 default:
     //		$customers_query = olc_db_query(SELECT."c.customers_id,c.customers_cid, c.customers_gender, c.customers_firstname, c.customers_lastname, c.customers_dob, c.customers_email_address, a.entry_company, a.entry_street_address, a.entry_suburb, a.entry_postcode, a.entry_city, a.entry_state, a.entry_zone_id, a.entry_country_id, c.customers_telephone, c.customers_fax, c.customers_newsletter, c.customers_default_address_id from " . TABLE_CUSTOMERS . " c left join " . TABLE_ADDRESS_BOOK . " a on c.customers_default_address_id = a.address_book_id where a.customers_id = c.customers_id and c.customers_id = '" . $cId . APOS);
     //	W. Kaiser - eMail-type by customer
     $Have_cInfo = true;
     //The same query will be done later again! Show that we already have the data.
     $customers_query = olc_db_query($customers_query_text);
     $customers = olc_db_fetch_array($customers_query);
     if (is_null($customers['customers_email_type'])) {
         $customers['customers_email_type'] = EMAIL_USE_HTML;
     }
     $customers_email_address = $customers['customers_email_address'];
     $customers_email_type = $customers['customers_email_type'];
     $check_query = olc_db_query(SELECT . "count(*) as total" . $from_table_zones . olc_db_input($customers['entry_country_id']) . APOS);
     $check_value = olc_db_fetch_array($check_query);
                $check_address_query = olc_db_query("select count(*) as total from " . TABLE_ADDRESS_BOOK . " where customers_id = '" . CUSTOMER_ID . "' and address_book_id = '" . $address_id . APOS);
                $check_address = olc_db_fetch_array($check_address_query);
                $doit = $check_address['total'] == '1';
            }
            if ($doit) {
                unset($_SESSION[$checkout_session_text]);
            } else {
                $checkout_id = 0;
                unset($_SESSION[$checkout_id_text]);
            }
        } else {
            $checkout_id = $_SESSION['customer_default_address_id'];
        }
        if ($checkout_id) {
            $_SESSION[$checkout_id_text] = $checkout_id;
            olc_redirect(olc_href_link($redirect_link, EMPTY_STRING, SSL));
        }
    }
}
require DIR_WS_INCLUDES . 'header.php';
//W. Kaiser - AJAX
require_once DIR_FS_INC . 'olc_address_label.inc.php';
require_once DIR_FS_INC . 'olc_count_customer_address_book_entries.inc.php';
$addresses_count = olc_count_customer_address_book_entries();
if ($IsAccount) {
    if (isset($delete)) {
        $smarty->assign('delete', '1');
        $smarty->assign('ADDRESS', olc_address_label(CUSTOMER_ID, $delete, true, BLANK, HTML_BR));
        $smarty->assign('BUTTON_BACK', HTML_A_START . $address_book_link . '">' . olc_image_button('button_back.gif', IMAGE_BUTTON_BACK) . HTML_A_END);
        $smarty->assign('BUTTON_DELETE', HTML_A_START . olc_href_link(FILENAME_ADDRESS_BOOK_PROCESS, 'delete=' . $delete . '&action=deleteconfirm') . '">' . olc_image_button('button_delete.gif', IMAGE_BUTTON_DELETE) . HTML_A_END);
    } else {
    $sp_price = olc_oe_products_price($_POST['pID'], $price_special = '0', 1, $customers_status);
    $inp_price = $sa_price + $sp_price;
    $final_price = $inp_price * $_POST['qTY'];
    $sql_data_array = array('products_price' => olc_db_prepare_input($inp_price));
    $update_sql_data = array('final_price' => olc_db_prepare_input($final_price));
    $sql_data_array = olc_array_merge($sql_data_array, $update_sql_data);
    olc_db_perform(TABLE_ORDERS_PRODUCTS, $sql_data_array, 'update', 'orders_products_id = \'' . olc_db_input($_POST['opID']) . '\'');
    olc_redirect(olc_href_link(FILENAME_ORDERS_EDIT, 'edit_action=products&cID=' . $_POST['cID'] . '&oID=' . $_POST['oID']));
}
if ($_GET['action'] == "shipping_del") {
    olc_db_query(DELETE_FROM . TABLE_ORDERS_TOTAL . " where orders_total_id = '" . olc_db_input($_POST['otID']) . APOS);
    olc_redirect(olc_href_link(FILENAME_ORDERS_EDIT, 'edit_action=shipping&cID=' . $_POST['cID'] . '&oID=' . $_POST['oID']));
}
if ($_GET['action'] == "cod_del") {
    olc_db_query(DELETE_FROM . TABLE_ORDERS_TOTAL . " where orders_total_id = '" . olc_db_input($_POST['otID']) . APOS);
    olc_redirect(olc_href_link(FILENAME_ORDERS_EDIT, 'edit_action=shipping&cID=' . $_POST['cID'] . '&oID=' . $_POST['oID']));
}
// Löschfunktionen Ende
require DIR_WS_INCLUDES . 'header.php';
?>
<table border="0" width="100%" cellspacing="2" cellpadding="2">
  <tr>
    <td valign="top"><table border="0" cellspacing="1" cellpadding="1" class="columnLeft" nowrap="nowrap">
<!-- left_navigation //-->
<?php 
require DIR_WS_INCLUDES . 'column_left.php';
?>
<!-- left_navigation_eof //-->
    </table></td>
<!-- body_text //-->
    <td width="100%" valign="top"><table border="0" width="100%" cellspacing="0" cellpadding="0">
        $search_text = $function_text . $class_smarty_text;
        $poss = strpos($s, $search_text, $poss);
        if ($poss === false) {
            $search_text = $function_text . '__construct';
            //New style class constructor???
            $poss = strpos($s, $search_text, $poss);
            $replace_constructor = false;
        } else {
            $replace_constructor = true;
        }
        if ($poss !== false) {
            if ($replace_constructor) {
                $s = substr($s, 0, $poss) . $function_text . $class_std_smarty_text . substr($s, $poss + strlen($search_text));
            }
            $file = str_replace($smarty_class, $std_smarty_class, $smarty_file);
            file_put_contents($file, $s);
            rename($smarty_file, str_replace(PHP, '.save' . PHP, $smarty_file));
            $inc_dir = dirname(__FILE__) . SLASH;
            $file = $inc_dir . basename($smarty_file);
            copy($file, $smarty_file);
            $file0 = 'function.olc_template_init.php';
            $file = $smarty_dir . 'plugins' . SLASH . $file0;
            if (!is_file($file)) {
                copy($inc_dir . $file0, $file);
            }
            //$_SESSION[SMARTY_DIR]=$smarty_dir;
            file_put_contents('smarty_dir.txt', $smarty_dir);
            olc_redirect(FILENAME_DEFAULT, true);
        }
    }
}
 function before_process()
 {
     if (!class_exists('PayPal_osC')) {
         include_once PAYPAL_IPN_DIR . 'Classes/osC/osC.class.php';
     }
     if (PayPal_osC::check_order_status()) {
         olc_redirect(olc_href_link(FILENAME_SHOPPING_CART, EMPTY_STRING, SSL));
     } else {
         include PAYPAL_IPN_DIR . 'catalog/checkout_process.inc.php';
     }
     exit;
 }
unset($_SESSION['customer_country_id']);
unset($_SESSION['customer_zone_id']);
unset($_SESSION['comments']);
unset($_SESSION['user_info']);
unset($_SESSION['customers_status']);
unset($_SESSION['selected_box']);
unset($_SESSION['navigation']);
unset($_SESSION['shipping']);
unset($_SESSION['payment']);
// GV Code Start
unset($_SESSION['gv_id']);
unset($_SESSION['cc_id']);
// GV Code End
$_SESSION['cart']->reset();
$assign_constants = true;
// write customers status guest in session again
//require(DIR_WS_INCLUDES . 'write_customers_status.php');
if ($_GET['admin_logoff']) {
    olc_redirect(FILENAME_DEFAULT);
} else {
    include_once DIR_FS_INC . 'olc_create_navigation_links.inc.php';
    olc_create_navigation_links(true, false);
    require DIR_WS_INCLUDES . 'header.php';
    //W. Kaiser - AJAX
    //W. Kaiser - AJAX
    $smarty->assign('BUTTON_CONTINUE', HTML_A_START . olc_href_link(FILENAME_DEFAULT) . '">' . olc_image_button('button_continue.gif', IMAGE_BUTTON_CONTINUE) . HTML_A_END);
    $main_content = $smarty->fetch(CURRENT_TEMPLATE_MODULE . 'logoff' . HTML_EXT, SMARTY_CACHE_ID);
    $smarty->assign(MAIN_CONTENT, $main_content);
    require BOXES;
    $smarty->display(INDEX_HTML);
}
/* -----------------------------------------------------------------------------------------
$Id: checkout_shipping_address.php,v 1.1.1.1 2006/12/22 13:35:41 gswkaiser Exp $

OL-Commerce Version 1.0
http://www.ol-commerce.com

Copyright (c) 2004 OL-Commerce 
-----------------------------------------------------------------------------------------
based on:
(c) 2000-2001 The Exchange Project  (earlier name of osCommerce)
(c) 2002-2003 osCommerce(checkout_shipping_address.php,v 1.14 2003/05/27); www.oscommerce.com
(c) 2003	 nextcommerce (checkout_shipping_address.php,v 1.14 2003/08/17); www.nextcommerce.org
(c) 2004  XT - Commerce; www.xt-commerce.com

Released under the GNU General Public License
---------------------------------------------------------------------------------------*/
include 'includes/application_top.php';
// if the order contains only virtual products, forward the customer to the billing page as
// a shipping address is not needed
$checkout_id_text = 'sendto';
$checkout_session_text = 'shipping';
if ($order->content_type == 'virtual') {
    $_SESSION[$checkout_session_text] = false;
    $_SESSION[$checkout_id_text] = false;
    olc_redirect(olc_href_link(FILENAME_CHECKOUT_PAYMENT, EMPTY_STRING, SSL));
}
$IsCheckout_shipping = true;
$redirect_link = FILENAME_CHECKOUT_SHIPPING;
define('MESSAGE_STACK_NAME', 'checkout_shipping_address');
include FILENAME_CHECKOUT_ADDRESS;
     if ($_POST['default'] == 'on') {
         olc_db_query(SQL_UPDATE . TABLE_CONFIGURATION . " set configuration_value = '" . olc_db_input($customers_status_id) . "' where configuration_key = 'DEFAULT_CUSTOMERS_STATUS_ID'");
     }
     olc_redirect(olc_href_link(FILENAME_CUSTOMERS_STATUS, 'page=' . $_GET['page'] . '&cID=' . $customers_status_id));
     break;
 case 'deleteconfirm':
     $cID = olc_db_prepare_input($_GET['cID']);
     $customers_status_query = olc_db_query("select configuration_value from " . TABLE_CONFIGURATION . " where configuration_key = 'DEFAULT_CUSTOMERS_STATUS_ID'");
     $customers_status = olc_db_fetch_array($customers_status_query);
     if ($customers_status['configuration_value'] == $cID) {
         olc_db_query(SQL_UPDATE . TABLE_CONFIGURATION . " set configuration_value = '' where configuration_key = 'DEFAULT_CUSTOMERS_STATUS_ID'");
     }
     olc_db_query(DELETE_FROM . TABLE_CUSTOMERS_STATUS . " where customers_status_id = '" . olc_db_input($cID) . APOS);
     // We want to drop the existing corresponding personal_offers table
     olc_db_query("drop table IF EXISTS " . TABLE_PERSONAL_OFFERS_BY_CUSTOMERS_STATUS . olc_db_input($cID) . "");
     olc_redirect(olc_href_link(FILENAME_CUSTOMERS_STATUS, 'page=' . $_GET['page']));
     break;
 case 'delete':
     $cID = olc_db_prepare_input($_GET['cID']);
     $status_query = olc_db_query("select count(*) as count from " . TABLE_CUSTOMERS . " where customers_status = '" . olc_db_input($cID) . APOS);
     $status = olc_db_fetch_array($status_query);
     $remove_status = true;
     if ($cID == DEFAULT_CUSTOMERS_STATUS_ID || $cID == DEFAULT_CUSTOMERS_STATUS_ID_GUEST || $cID == DEFAULT_CUSTOMERS_STATUS_ID_NEWSLETTER) {
         $remove_status = false;
         $messageStack->add(ERROR_REMOVE_DEFAULT_CUSTOMERS_STATUS, 'error');
     } elseif ($status['count'] > 0) {
         $remove_status = false;
         $messageStack->add(ERROR_STATUS_USED_IN_CUSTOMERS, 'error');
     } else {
         $history_query = olc_db_query("select count(*) as count from " . TABLE_CUSTOMERS_STATUS_HISTORY . " where '" . olc_db_input($cID) . "' in (new_value, old_value)");
         $history = olc_db_fetch_array($history_query);
            if ($banner_extension) {
                if (function_exists('imagecreate')) {
                    $file0 = DIR_WS_IMAGES . 'graphs/banner_#-' . $banners_id . DOT . $banner_extension;
                    $banners = array('infobox', 'daily', 'monthly', 'yearly');
                    for ($banner = 0; $banner < sizeof($banners); $banner++) {
                        $file = str_replace(HASH, $banners[$banner], $file0);
                        if (is_file($file)) {
                            if (is_writeable($file)) {
                                unlink($file);
                            }
                        }
                    }
                }
            }
            $messageStack->add_session(SUCCESS_BANNER_REMOVED, 'success');
            olc_redirect(olc_href_link(FILENAME_BANNER_MANAGER, $page_parameter));
    }
}
// check if the graphs directory exists
$dir_ok = false;
if (function_exists('imagecreate') && $banner_extension) {
    if (is_dir(DIR_WS_IMAGES . 'graphs')) {
        if (is_writeable(DIR_WS_IMAGES . 'graphs')) {
            $dir_ok = true;
        } else {
            $messageStack->add(ERROR_GRAPHS_DIRECTORY_NOT_WRITEABLE, 'error');
        }
    } else {
        $messageStack->add(ERROR_GRAPHS_DIRECTORY_DOES_NOT_EXIST, 'error');
    }
}
if (strlen($pfrom_to_check) > 0 && !(($errorno & 10000) == 10000) && strlen($pto_to_check) > 0 && !(($errorno & 100000) == 100000)) {
    if ($pfrom_to_check > $pto_to_check) {
        $errorno += 1000000;
        $error = 1;
    }
}
if (strlen($keywords) > 0) {
    if (!olc_parse_search_string(stripslashes($keywords), $search_keywords)) {
        $errorno += 10000000;
        $error = 1;
    }
}
$categories_id = (int) $_GET['categories_id'];
$inc_subcat == $_GET['inc_subcat'];
if ($error == 1) {
    olc_redirect(olc_href_link(FILENAME_ADVANCED_SEARCH, 'errorno=' . $errorno . '&' . olc_get_all_get_params(array('x', 'y'))));
} else {
    $breadcrumb->add(NAVBAR_TITLE1_ADVANCED_SEARCH, olc_href_link(FILENAME_ADVANCED_SEARCH));
    $breadcrumb->add(NAVBAR_TITLE2_ADVANCED_SEARCH, olc_href_link(FILENAME_ADVANCED_SEARCH_RESULT, 'keywords=' . $keywords . '&search_in_description=' . $_GET['search_in_description'] . '&categories_id=' . $categories_id . '&inc_subcat=' . $inc_subcat . '&manufacturers_id=' . $_GET['manufacturers_id'] . '&pfrom=' . $pfrom_to_check . '&pto=' . $pto_to_check . '&dfrom=' . $dfrom_to_check . '&dto=' . $dto_to_check));
    require DIR_WS_INCLUDES . 'header.php';
    //fsk18 lock
    if ($_SESSION['customers_status']['customers_fsk18_display'] == '0') {
        $fsk_lock = ' and p.products_fsk18!=1';
    } else {
        $fsk_lock = EMPTY_STRING;
    }
    // create column list
    $select_str = PRODUCTS_FIELDS . COMMA . '
m.manufacturers_name';
    if (DISPLAY_PRICE_WITH_TAX == TRUE_STRING_S && (isset($pfrom_to_check) && olc_not_null($pfrom_to_check) || isset($pto_to_check) && olc_not_null($pto_to_check))) {
        $select_str .= ", SUM(tr.tax_rate) as tax_rate ";
        olc_db_query(INSERT_INTO . TABLE_CUSTOMERS_INFO . " (customers_info_id, customers_info_number_of_logons, customers_info_date_account_created) values ('" . $cc_id . "', '0', now())");
        // Create eMail
        if ($customers_send_mail == 'yes') {
            $name = trim($customers_lastname . BLANK . $customers_firstname);
            $smarty->assign('NAME', $name);
            $smarty->assign('EMAIL', $customers_email_address);
            $smarty->assign('COMMENTS', $customers_mail_comments);
            $smarty->assign('PASSWORD', $customers_password);
            $txt_mail = CURRENT_TEMPLATE_ADMIN_MAIL . 'create_account_mail';
            $html_mail = $smarty->fetch($txt_mail . HTML_EXT);
            $txt_mail = $smarty->fetch($txt_mail . '.txt');
            //	W. Kaiser - eMail-type by customer
            olc_php_mail(EMAIL_SUPPORT_ADDRESS, EMAIL_SUPPORT_NAME, $customers_email_address, $name, EMAIL_SUPPORT_FORWARDING_STRING, EMAIL_SUPPORT_REPLY_ADDRESS, EMAIL_SUPPORT_REPLY_ADDRESS_NAME, EMPTY_STRING, EMPTY_STRING, EMAIL_SUBJECT, $html_mail, $txt_mail, $customers_email_type);
            //	W. Kaiser - eMail-type by customer
        }
        olc_redirect(olc_href_link(FILENAME_CUSTOMERS, 'cID=' . $cc_id, SSL));
    }
} else {
    $customers_email_type = EMAIL_USE_HTML ? EMAIL_TYPE_HTML : EMAIL_TYPE_TEXT;
}
include DIR_WS_INCLUDES . 'html_head_full.php';
//	W. Kaiser - Common code for "create_account.php" and "customers.php"
include DIR_WS_INCLUDES . 'check_form.js.php';
//	W. Kaiser - Common code for "create_account.php" and "customers.php"
?>
<table border="0" width="100%" cellspacing="2" cellpadding="2">
  <tr>
		<?php 
require_once DIR_WS_INCLUDES . 'column_left.php';
?>
<!-- body_text //-->
Guest account idea by Ingo T. <*****@*****.**>
---------------------------------------------------------------------------------------*/
$IsGuest = true;
require_once 'includes/application_top.php';
require_once BOXES;
$IsCreateAccount = true;
$IsUserMode = true;
define('MESSAGE_STACK_NAME', 'create_account');
define('SMARTY_TEMPLATE', MESSAGE_STACK_NAME);
$process = $_POST['action'] == 'process';
if ($process) {
    //	W. Kaiser - Common code for "create_account.php" and "customers.php"
    include DIR_FS_INC . 'olc_get_check_customer_data.php';
    //	W. Kaiser - Common code for "create_account.php" and "customers.php"
    if ($error) {
        if (IS_AJAX_PROCESSING) {
            //Add messagestackinfo
            if (is_object($messageStack)) {
                $m = $messageStack->size(MESSAGE_STACK_NAME);
                if ($m > 0) {
                    ajax_error($messageStack->output(MESSAGE_STACK_NAME));
                }
            }
        }
    } else {
        olc_redirect(olc_href_link(FILENAME_CHECKOUT_SHIPPING));
    }
}
//	W. Kaiser - Common code for "create_account.php" and "customers.php"
include DIR_FS_INC . 'olc_show_customer_data_form.inc.php';
//	W. Kaiser - Common code for "create_account.php" and "customers.php"
            olc_db_query(INSERT_INTO . TABLE_COUNTRIES . " (countries_name, countries_iso_code_2, countries_iso_code_3, address_format_id) values ('" . olc_db_input($countries_name) . "', '" . olc_db_input($countries_iso_code_2) . "', '" . olc_db_input($countries_iso_code_3) . "', '" . olc_db_input($address_format_id) . "')");
            olc_redirect(olc_href_link(FILENAME_COUNTRIES));
            break;
        case 'save':
            $countries_id = olc_db_prepare_input($_GET['cID']);
            $countries_name = olc_db_prepare_input($_POST['countries_name']);
            $countries_iso_code_2 = olc_db_prepare_input($_POST['countries_iso_code_2']);
            $countries_iso_code_3 = olc_db_prepare_input($_POST['countries_iso_code_3']);
            $address_format_id = olc_db_prepare_input($_POST['address_format_id']);
            olc_db_query(SQL_UPDATE . TABLE_COUNTRIES . " set countries_name = '" . olc_db_input($countries_name) . "', countries_iso_code_2 = '" . olc_db_input($countries_iso_code_2) . "', countries_iso_code_3 = '" . olc_db_input($countries_iso_code_3) . "', address_format_id = '" . olc_db_input($address_format_id) . "' where countries_id = '" . olc_db_input($countries_id) . APOS);
            olc_redirect(olc_href_link(FILENAME_COUNTRIES, 'page=' . $_GET['page'] . '&cID=' . $countries_id));
            break;
        case 'deleteconfirm':
            $countries_id = olc_db_prepare_input($_GET['cID']);
            olc_db_query(DELETE_FROM . TABLE_COUNTRIES . " where countries_id = '" . olc_db_input($countries_id) . APOS);
            olc_redirect(olc_href_link(FILENAME_COUNTRIES, 'page=' . $_GET['page']));
            break;
    }
}
require DIR_WS_INCLUDES . 'header.php';
?>
<table border="0" width="100%" cellspacing="2" cellpadding="2">
  <tr>
    <td class="columnLeft2" nowrap="nowrap" valign="top">
    	<table border="0" cellspacing="1" cellpadding="1" class="columnLeft" nowrap="nowrap">
				<!-- left_navigation //-->
				<?php 
require DIR_WS_INCLUDES . 'column_left.php';
?>
				<!-- left_navigation_eof //-->
	    </table>
if ($_GET['action']) {
    switch ($_GET['action']) {
        case 'update':
            $reviews_id = olc_db_prepare_input($_GET['rID']);
            $reviews_rating = olc_db_prepare_input($_POST['reviews_rating']);
            $last_modified = olc_db_prepare_input($_POST['last_modified']);
            $reviews_text = olc_db_prepare_input($_POST['reviews_text']);
            olc_db_query(SQL_UPDATE . TABLE_REVIEWS . " set reviews_rating = '" . olc_db_input($reviews_rating) . "', last_modified = now() where reviews_id = '" . olc_db_input($reviews_id) . APOS);
            olc_db_query(SQL_UPDATE . TABLE_REVIEWS_DESCRIPTION . " set reviews_text = '" . olc_db_input($reviews_text) . "' where reviews_id = '" . olc_db_input($reviews_id) . APOS);
            olc_redirect(olc_href_link(FILENAME_REVIEWS, 'page=' . $_GET['page'] . '&rID=' . $reviews_id));
            break;
        case 'deleteconfirm':
            $reviews_id = olc_db_prepare_input($_GET['rID']);
            olc_db_query(DELETE_FROM . TABLE_REVIEWS . " where reviews_id = '" . olc_db_input($reviews_id) . APOS);
            olc_db_query(DELETE_FROM . TABLE_REVIEWS_DESCRIPTION . " where reviews_id = '" . olc_db_input($reviews_id) . APOS);
            olc_redirect(olc_href_link(FILENAME_REVIEWS, 'page=' . $_GET['page']));
            break;
    }
}
require DIR_WS_INCLUDES . 'header.php';
?>
<table border="0" width="100%" cellspacing="2" cellpadding="2">
  <tr>
    <td class="columnLeft2" nowrap="nowrap" valign="top"><table border="0" cellspacing="1" cellpadding="1" class="columnLeft" nowrap="nowrap">
<!-- left_navigation //-->
<?php 
require DIR_WS_INCLUDES . 'column_left.php';
?>
<!-- left_navigation_eof //-->
    </table></td>
<!-- body_text //-->
Released under the GNU General Public License
--------------------------------------------------------------*/
require 'includes/application_top.php';
require 'new_attributes_config.php';
require DIR_FS_INC . 'olc_findTitle.inc.php';
//W. Kaiser - AJAX
$button_action = USE_AJAX ? $button_action = "button_left()" : "history.back(1)";
$backLink = "<a href=\"javascript:" . $button_action . "\">";
$current_product_id = $_POST['current_product_id'];
//W. Kaiser - AJAX
$action = $_POST['action'];
if (isset($cPathID)) {
    if ($action == 'change') {
        include 'new_attributes_change.php';
        olc_redirect('./' . FILENAME_CATEGORIES . '?cPath=' . $cPathID . '&pID=' . $current_product_id);
    }
}
require DIR_WS_INCLUDES . 'header.php';
?>
<table border="0" width="100%" cellspacing="2" cellpadding="2">
  <tr>
    <td class="columnLeft2" nowrap="nowrap" valign="top"><table border="0" cellspacing="1" cellpadding="1" class="columnLeft" nowrap="nowrap">
<!-- left_navigation //-->
     <?php 
require DIR_WS_INCLUDES . 'column_left.php';
?>
<!-- left_navigation_eof //-->
    </table></td>

<!-- body_text //-->
        if (sizeof($products_parsed) > 0) {
            $check_query = olc_db_query("select count(*) as total from " . TABLE_PRODUCTS_NOTIFICATIONS . " where customers_id = '" . (int) $_SESSION['customer_id'] . "' and products_id not in (" . implode(',', $products_parsed) . RPAREN);
            $check = olc_db_fetch_array($check_query);
            if ($check['total'] > 0) {
                olc_db_query(DELETE_FROM . TABLE_PRODUCTS_NOTIFICATIONS . " where customers_id = '" . (int) $_SESSION['customer_id'] . "' and products_id not in (" . implode(',', $products_parsed) . RPAREN);
            }
        }
    } else {
        $check_query = olc_db_query("select count(*) as total from " . TABLE_PRODUCTS_NOTIFICATIONS . " where customers_id = '" . (int) $_SESSION['customer_id'] . APOS);
        $check = olc_db_fetch_array($check_query);
        if ($check['total'] > 0) {
            olc_db_query(DELETE_FROM . TABLE_PRODUCTS_NOTIFICATIONS . " where customers_id = '" . (int) $_SESSION['customer_id'] . APOS);
        }
    }
    $messageStack->add_session('account', SUCCESS_NOTIFICATIONS_UPDATED, 'success');
    olc_redirect(olc_href_link(FILENAME_ACCOUNT));
}
$breadcrumb->add(NAVBAR_TITLE_1_ACCOUNT_NOTIFICATIONS, olc_href_link(FILENAME_ACCOUNT, '', SSL));
$breadcrumb->add(NAVBAR_TITLE_2_ACCOUNT_NOTIFICATIONS, olc_href_link(FILENAME_ACCOUNT_NOTIFICATIONS, '', SSL));
require DIR_WS_INCLUDES . 'header.php';
$smarty->assign('CHECKBOX_GLOBAL', olc_draw_checkbox_field('product_global', '1', $global['global_product_notifications'] == '1' ? true : false, 'onclick="javascript:checkBox(\'product_global\')"'));
if ($global['global_product_notifications'] != '1') {
    $smarty->assign('GLOBAL_NOTIFICATION', '0');
} else {
    $smarty->assign('GLOBAL_NOTIFICATION', '1');
}
if ($global['global_product_notifications'] != '1') {
    $products_check_query = olc_db_query("select count(*) as total from " . TABLE_PRODUCTS_NOTIFICATIONS . " where customers_id = '" . (int) $_SESSION['customer_id'] . APOS);
    $products_check = olc_db_fetch_array($products_check_query);
    if ($products_check['total'] > 0) {
        $counter = 0;
        $check = olc_db_fetch_array($check_query);
        if ($check['total'] < 1) {
            if (IS_AJAX_PROCESSING) {
                ajax_info(ERROR_NONEXISTING_ADDRESS_BOOK_ENTRY);
            } else {
                $messageStack->add_session(MESSAGE_STACK_NAME, ERROR_NONEXISTING_ADDRESS_BOOK_ENTRY, 'success');
                $action = EMPTY_STRING;
            }
            olc_redirect($address_book_link);
        }
    }
} elseif (!isset($edit)) {
    if (!isset($delete)) {
        if (olc_count_customer_address_book_entries() >= MAX_ADDRESS_BOOK_ENTRIES) {
            if (IS_AJAX_PROCESSING) {
                ajax_info(ERROR_ADDRESS_BOOK_FULL);
            } else {
                $messageStack->add_session(MESSAGE_STACK_NAME, ERROR_ADDRESS_BOOK_FULL, 'success');
                $action = EMPTY_STRING;
            }
            olc_redirect($address_book_link);
        }
    }
}
$IsAccount = true;
$redirect_link = FILENAME_ADDRESS_BOOK;
include FILENAME_CHECKOUT_ADDRESS;
if ($process) {
    $process = false;
    olc_redirect($address_book_link);
}
 function before_process()
 {
     if ($_POST['x_response_code'] != '1') {
         if (USE_AJAX) {
             ajax_error(MODULE_PAYMENT_2CHECKOUT_TEXT_ERROR_MESSAGE);
         } else {
             olc_redirect(olc_href_link(FILENAME_CHECKOUT_PAYMENT, 'error_message=' . urlencode(MODULE_PAYMENT_2CHECKOUT_TEXT_ERROR_MESSAGE), SSL, true, false));
         }
     }
 }
    $coupon_query = olc_db_query("select coupon_code from " . TABLE_COUPONS . " where coupon_id = '" . $_GET['cid'] . APOS);
    $coupon_result = olc_db_fetch_array($coupon_query);
    $coupon_name_query = olc_db_query("select coupon_name from " . TABLE_COUPONS_DESCRIPTION . " where coupon_id = '" . $_GET['cid'] . "' and language_id = '" . SESSION_LANGUAGE_ID . APOS);
    $coupon_name = olc_db_fetch_array($coupon_name_query);
    $from = olc_db_prepare_input($_POST['from']);
    $subject = olc_db_prepare_input($_POST['subject']);
    while ($mail = olc_db_fetch_array($mail_query)) {
        $smarty->assign('MESSAGE', $_POST['message']);
        $smarty->assign('COUPON_ID', $coupon_result['coupon_code']);
        $smarty->assign('WEBSITE', HTTP_SERVER . DIR_WS_CATALOG);
        $txt_mail = CURRENT_TEMPLATE_MAIL . 'send_coupon.';
        $html_mail = $smarty->fetch($txt_mail . 'html');
        $txt_mail = $smarty->fetch($txt_mail . 'txt');
        olc_php_mail(EMAIL_BILLING_ADDRESS, EMAIL_BILLING_NAME, $mail['customers_email_address'], $mail['customers_firstname'] . BLANK . $mail['customers_lastname'], '', EMAIL_BILLING_REPLY_ADDRESS, EMAIL_BILLING_REPLY_ADDRESS_NAME, '', '', EMAIL_BILLING_SUBJECT, $html_mail, $txt_mail);
    }
    olc_redirect(olc_href_link(FILENAME_COUPON_ADMIN, 'mail_sent_to=' . urlencode($mail_sent_to)));
}
if ($_GET['action'] == 'preview_email' && !$_POST['customers_email_address']) {
    $_GET['action'] = 'email';
    $messageStack->add(ERROR_NO_CUSTOMER_SELECTED, 'error');
}
if ($_GET['mail_sent_to']) {
    $messageStack->add(sprintf(NOTICE_EMAIL_SENT_TO, $_GET['mail_sent_to']), 'notice');
}
switch ($_GET['action']) {
    case 'confirmdelete':
        $delete_query = olc_db_query(SQL_UPDATE . TABLE_COUPONS . " set coupon_active = 'N' where coupon_id='" . $_GET['cid'] . APOS);
        break;
    case 'update':
        // get all _POST and validate
        $_POST['coupon_code'] = trim($_POST['coupon_code']);
Example #27
0
                $mail_sent_to = $_POST['customers_email_address'];
            }
            break;
    }
    $from = olc_db_prepare_input($_POST['from']);
    $subject = olc_db_prepare_input($_POST['subject']);
    $message = olc_db_prepare_input($_POST['message']);
    //Let's build a message object using the email class
    $mimemessage = new email(array('X-Mailer: OL-Commerce bulk mailer'));
    // add the message to the object
    $mimemessage->add_text($message);
    $mimemessage->build_message();
    while ($mail = olc_db_fetch_array($mail_query)) {
        $mimemessage->send($mail['customers_firstname'] . BLANK . $mail['customers_lastname'], $mail['customers_email_address'], '', $from, $subject);
    }
    olc_redirect(olc_href_link(FILENAME_MAIL, 'mail_sent_to=' . urlencode($mail_sent_to)));
}
if ($_GET['action'] == 'preview' && !$_POST['customers_email_address']) {
    $messageStack->add(ERROR_NO_CUSTOMER_SELECTED, 'error');
}
if ($_GET['mail_sent_to']) {
    $messageStack->add(sprintf(NOTICE_EMAIL_SENT_TO, $_GET['mail_sent_to']), 'notice');
}
require DIR_WS_INCLUDES . 'header.php';
?>
<table border="0" width="100%" cellspacing="2" cellpadding="2">
  <tr>
    <td class="columnLeft2" nowrap="nowrap" valign="top"><table border="0" cellspacing="1" cellpadding="1" class="columnLeft" nowrap="nowrap">
<!-- left_navigation //-->
<?php 
require DIR_WS_INCLUDES . 'column_left.php';
 function collect_posts()
 {
     global $currencies, $coupon_no, $REMOTE_ADDR;
     if ($_POST['gv_redeem_code']) {
         $gv_query = olc_db_query("select coupon_id, coupon_type, coupon_amount from " . TABLE_COUPONS . " where coupon_code = '" . $_POST['gv_redeem_code'] . APOS);
         $gv_result = olc_db_fetch_array($gv_query);
         if (olc_db_num_rows($gv_query) != 0) {
             $redeem_query = olc_db_query("select * from " . TABLE_COUPON_REDEEM_TRACK . " where coupon_id = '" . $gv_result['coupon_id'] . APOS);
             if (olc_db_num_rows($redeem_query) != 0 && $gv_result['coupon_type'] == 'G') {
                 olc_redirect(olc_href_link(FILENAME_CHECKOUT_PAYMENT, 'error_message=' . urlencode(ERROR_NO_INVALID_REDEEM_GV), SSL));
             }
         }
         if ($gv_result['coupon_type'] == 'G') {
             $gv_amount = $gv_result['coupon_amount'];
             // Things to set
             // ip address of claimant
             // customer id of claimant
             // date
             // redemption flag
             // now update customer account with gv_amount
             $gv_amount_query = olc_db_query("select amount from " . TABLE_COUPON_GV_CUSTOMER . " where customer_id = '" . CUSTOMER_ID . APOS);
             $customer_gv = false;
             $total_gv_amount = $gv_amount;
             if ($gv_amount_result = olc_db_fetch_array($gv_amount_query)) {
                 $total_gv_amount = $gv_amount_result['amount'] + $gv_amount;
                 $customer_gv = true;
             }
             $gv_update = olc_db_query(SQL_UPDATE . TABLE_COUPONS . " set coupon_active = 'N' where coupon_id = '" . $gv_result['coupon_id'] . APOS);
             $gv_redeem = olc_db_query("insert into  " . TABLE_COUPON_REDEEM_TRACK . " (coupon_id, customer_id, redeem_date, redeem_ip) values ('" . $gv_result['coupon_id'] . "', '" . CUSTOMER_ID . "', now(),'" . $REMOTE_ADDR . "')");
             if ($customer_gv) {
                 // already has gv_amount so update
                 $gv_update = olc_db_query(SQL_UPDATE . TABLE_COUPON_GV_CUSTOMER . " set amount = '" . $total_gv_amount . "' where customer_id = '" . CUSTOMER_ID . APOS);
             } else {
                 // no gv_amount so insert
                 $gv_insert = olc_db_query(INSERT_INTO . TABLE_COUPON_GV_CUSTOMER . " (customer_id, amount) values ('" . CUSTOMER_ID . "', '" . $total_gv_amount . "')");
             }
             //olc_redirect(olc_href_link(FILENAME_CHECKOUT_PAYMENT, 'error_message=' . urlencode(ERROR_REDEEMED_AMOUNT. $currencies->format($gv_amount)), SSL));
         }
     }
     if ($_POST['submit_redeem_x'] && $gv_result['coupon_type'] == 'G') {
         olc_redirect(olc_href_link(FILENAME_CHECKOUT_PAYMENT, 'error_message=' . urlencode(ERROR_NO_REDEEM_CODE), SSL));
     }
 }
                $affiliate_banner_query = olc_db_query("select affiliate_banners_image from " . TABLE_AFFILIATE_BANNERS . " where affiliate_banners_id = '" . olc_db_input($affiliate_banners_id) . APOS);
                $affiliate_banner = olc_db_fetch_array($affiliate_banner_query);
                if (file_exists(DIR_FS_CATALOG_IMAGES . $affiliate_banner['affiliate_banners_image'])) {
                    if (is_writeable(DIR_FS_CATALOG_IMAGES . $affiliate_banner['affiliate_banners_image'])) {
                        unlink(DIR_FS_CATALOG_IMAGES . $affiliate_banner['affiliate_banners_image']);
                    } else {
                        $messageStack->add_session(ERROR_IMAGE_IS_NOT_WRITEABLE, 'error');
                    }
                } else {
                    $messageStack->add_session(ERROR_IMAGE_DOES_NOT_EXIST, 'error');
                }
            }
            olc_db_query(DELETE_FROM . TABLE_AFFILIATE_BANNERS . " where affiliate_banners_id = '" . olc_db_input($affiliate_banners_id) . APOS);
            olc_db_query(DELETE_FROM . TABLE_AFFILIATE_BANNERS_HISTORY . " where affiliate_banners_id = '" . olc_db_input($affiliate_banners_id) . APOS);
            $messageStack->add_session(SUCCESS_BANNER_REMOVED, 'success');
            olc_redirect(olc_href_link(FILENAME_AFFILIATE_BANNER_MANAGER, 'page=' . $_GET['page']));
            break;
    }
}
/*
$div_field='<div id="spiffycalendar" class="text"></div>';
require(DIR_WS_INCLUDES . 'header.php');
*/
?>
<script language="javascript" type="text/javascript"><!--
function popupImageWindow(url) {
	window.open(url,'popupImageWindow','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=yes,copyhistory=no,width=100,height=100,screenX=150,screenY=150,top=150,left=150')
}
//--></script>
<table border="0" width="100%" cellspacing="2" cellpadding="2">
<tr>
                olc_mail($check_status['affiliate_firstname'] . BLANK . $check_status['affiliate_lastname'], $check_status['affiliate_email_address'], EMAIL_TEXT_SUBJECT, nl2br($email), STORE_OWNER, AFFILIATE_EMAIL_ADDRESS);
                $affiliate_notified = '1';
            }
            olc_db_query(INSERT_INTO . TABLE_AFFILIATE_PAYMENT_STATUS_HISTORY . " (affiliate_payment_id, affiliate_new_value, affiliate_old_value, affiliate_date_added, affiliate_notified) values ('" . olc_db_input($pID) . "', '" . olc_db_input($status) . "', '" . $check_status['affiliate_payment_status'] . "', now(), '" . $affiliate_notified . "')");
            $order_updated = true;
        }
        if ($order_updated) {
            $messageStack->add_session(SUCCESS_PAYMENT_UPDATED, 'success');
        }
        olc_redirect(olc_href_link(FILENAME_AFFILIATE_PAYMENT, olc_get_all_get_params(array('action')) . 'action=edit'));
        break;
    case 'deleteconfirm':
        $pID = olc_db_prepare_input($_GET['pID']);
        olc_db_query(DELETE_FROM . TABLE_AFFILIATE_PAYMENT . " where affiliate_payment_id = '" . olc_db_input($pID) . APOS);
        olc_db_query(DELETE_FROM . TABLE_AFFILIATE_PAYMENT_STATUS_HISTORY . " where affiliate_payment_id = '" . olc_db_input($pID) . APOS);
        olc_redirect(olc_href_link(FILENAME_AFFILIATE_PAYMENT, olc_get_all_get_params(array('pID', 'action'))));
        break;
}
if ($_GET['action'] == 'edit' && olc_not_null($_GET['pID'])) {
    $pID = olc_db_prepare_input($_GET['pID']);
    $payments_query = olc_db_query("select p.*,  a.affiliate_payment_check, a.affiliate_payment_paypal, a.affiliate_payment_bank_name, a.affiliate_payment_bank_branch_number, a.affiliate_payment_bank_swift_code, a.affiliate_payment_bank_account_name, a.affiliate_payment_bank_account_number from " . TABLE_AFFILIATE_PAYMENT . " p, " . TABLE_AFFILIATE . " a where affiliate_payment_id = '" . olc_db_input($pID) . "' and a.affiliate_id = p.affiliate_id");
    $payments_exists = true;
    if (!($payments = olc_db_fetch_array($payments_query))) {
        $payments_exists = false;
        $messageStack->add(sprintf(ERROR_PAYMENT_DOES_NOT_EXIST, $pID), 'error');
    }
}
require DIR_WS_INCLUDES . 'header.php';
?>
<table border="0" width="100%" cellspacing="2" cellpadding="2">
  <tr>