Execute($sql); if ($check_customer->RecordCount()) { $check_customer_values = $check_customer->fields; // Crypted password mods - create a new password, update the database and mail it to them $newpass = oos_create_random_value(ENTRY_PASSWORD_MIN_LENGTH); $crypted_password = oos_encrypt_password($newpass); $customerstable = $oostable['customers']; $dbconn->Execute("UPDATE $customerstable SET customers_password = '" . oos_db_input($crypted_password) . "' WHERE customers_id = '" . intval($_GET['cID']) . "'"); $name = $check_customer_values['customers_firstname'] . " " . $check_customer_values['customers_lastname']; if (ACCOUNT_GENDER == 'true') { if ($check_customer_values['customers_gender'] == 'm') { $email_text = EMAIL_GREET_MR . $check_customer_values['customers_lastname'] . ',' . "\n\n"; } else { $email_text = EMAIL_GREET_MS . $check_customer_values['customers_lastname'] . ',' . "\n\n"; } } else { $email_text = EMAIL_GREET_NONE; } $email_text .= EMAIL_WELCOME; if (MODULE_ORDER_TOTAL_GV_STATUS == 'true') { if (NEW_SIGNUP_GIFT_VOUCHER_AMOUNT > 0) { $coupon_code = oos_create_coupon_code(); $couponstable = $oostable['coupons']; $insert_result = $dbconn->Execute("INSERT INTO $couponstable (coupon_code, coupon_type, coupon_amount, date_created) VALUES ('" . oos_db_input($coupon_code) . "', 'G', '" . NEW_SIGNUP_GIFT_VOUCHER_AMOUNT . "', now())"); $insert_id = $dbconn->Insert_ID(); $coupon_email_tracktable = $oostable['coupon_email_track']; $insert_result = $dbconn->Execute("INSERT INTO $coupon_email_tracktable (coupon_id, customer_id_sent, sent_firstname, emailed_to, date_sent) VALUES ('" . intval($insert_id) ."', '0', 'Admin', '" . oos_db_input($email_address) . "', now() )"); $email_text .= 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 . oos_catalog_link($aCatalog['gv_redeem'], 'gv_no=' . $coupon_code) . "\n\n"; } if (NEW_SIGNUP_DISCOUNT_COUPON != '') { $coupon_id = NEW_SIGNUP_DISCOUNT_COUPON; $couponstable = $oostable['coupons']; $sql = "SELECT coupon_id coupon_type, coupon_code, coupon_amount FROM $couponstable WHERE coupon_id = '" . intval($coupon_id) . "'"; $coupon_result = $dbconn->Execute($sql); $coupon = $coupon_result->fields; $coupons_descriptiontable = $oostable['coupons_description']; $sql = "SELECT coupon_name, coupon_description FROM $coupons_descriptiontable WHERE coupon_id = '" . intval($coupon_id) . "' AND coupon_languages_id = '" . intval($_SESSION['language_id']) . "'"; $coupon_desc_result = $dbconn->Execute($sql); $coupon_desc = $coupon_desc_result->fields; $coupon_email_tracktable = $oostable['coupon_email_track']; $insert_result = $dbconn->Execute("INSERT INTO $coupon_email_tracktable (coupon_id, customer_id_sent, sent_firstname, emailed_to, date_sent) VALUES ('" . intval($coupon_id) ."', '0', 'Admin', '" . oos_db_input($email_address) . "', now() )"); $email_text .= EMAIL_COUPON_INCENTIVE_HEADER . "\n\n" . $coupon_desc['coupon_description'] . sprintf(EMAIL_COUPON_REDEEM, $coupon['coupon_code']) . "\n\n" . "\n\n"; } } $email_text .= EMAIL_TEXT; $email_text .= sprintf(EMAIL_PASSWORD_BODY, $newpass); $email_text .= EMAIL_CONTACT; oos_mail($name, $check_customer_values['customers_email_address'], EMAIL_SUBJECT, nl2br($email_text), STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS); oos_redirect_admin(oos_href_link_admin($aContents['customers'], 'selected_box=customers&page=' . $nPage . '&cID=' . $_GET['cID'])); } } } } break; case 'statusconfirm': $customers_id = oos_db_prepare_input($_GET['cID']); $customerstable = $oostable['customers']; $check_status_sql = "SELECT customers_status FROM $customerstable WHERE customers_id = '" . intval($customers_id) . "'"; $customers_status = $dbconn->GetOne($check_status_sql); if ($customers_status != $pdm_status) { $customerstable = $oostable['customers']; $dbconn->Execute("UPDATE $customerstable SET customers_status = '" . intval($pdm_status) . "' WHERE customers_id = '" . intval($customers_id) . "'"); $customers_status_historytable = $oostable['customers_status_history']; $dbconn->Execute("INSERT INTO $customers_status_historytable (customers_id, new_value, old_value, date_added, customer_notified) VALUES ('" . intval($customers_id) . "', '" . intval($pdm_status) . "', '" . intval($customers_status) . "', now(), '" . oos_db_input($customer_notified) . "')"); } break; case 'update': $customers_id = oos_db_prepare_input($_GET['cID']); $customers_firstname = oos_db_prepare_input($_POST['customers_firstname']); $customers_lastname = oos_db_prepare_input($_POST['customers_lastname']); $customers_email_address = oos_db_prepare_input($_POST['customers_email_address']); $customers_telephone = oos_db_prepare_input($_POST['customers_telephone']); $customers_max_order = oos_db_prepare_input($_POST['customers_max_order']); $customers_gender = oos_db_prepare_input($_POST['customers_gender']); $customers_dob = oos_db_prepare_input($_POST['customers_dob']); $entry_street_address = oos_db_prepare_input($_POST['entry_street_address']); $entry_postcode = oos_db_prepare_input($_POST['entry_postcode']); $entry_city = oos_db_prepare_input($_POST['entry_city']); $entry_country_id = oos_db_prepare_input($_POST['entry_country_id']); $entry_company = oos_db_prepare_input($_POST['entry_company']); $entry_owner = oos_db_prepare_input($_POST['entry_owner']); $entry_vat_id = oos_db_prepare_input($_POST['entry_vat_id']); $entry_vat_id_status = oos_db_prepare_input($_POST['entry_vat_id_status']); $entry_state = oos_db_prepare_input($_POST['entry_state']); $entry_zone_id = oos_db_prepare_input($_POST['entry_zone_id']); $default_address_id = oos_db_prepare_input($_POST['default_address_id']); $sql_data_array = array('customers_firstname' => $customers_firstname, 'customers_lastname' => $customers_lastname, 'customers_email_address' => $customers_email_address, 'customers_telephone' => $customers_telephone, 'customers_max_order' => $customers_max_order); if (ACCOUNT_GENDER == 'true') $sql_data_array['customers_gender'] = $customers_gender; if (ACCOUNT_DOB == 'true') $sql_data_array['customers_dob'] = oos_date_raw($customers_dob); oos_db_perform($oostable['customers'], $sql_data_array, 'UPDATE', "customers_id = '" . intval($customers_id) . "'"); $customers_infotable = $oostable['customers_info']; $dbconn->Execute("UPDATE $customers_infotable SET customers_info_date_account_last_modified = now() WHERE customers_info_id = '" . intval($customers_id) . "'"); if ($entry_zone_id > 0) $entry_state = ''; $sql_data_array = array('entry_firstname' => $customers_firstname, 'entry_lastname' => $customers_lastname, 'entry_street_address' => $entry_street_address, 'entry_postcode' => $entry_postcode, 'entry_city' => $entry_city, 'entry_country_id' => $entry_country_id); if (ACCOUNT_COMPANY == 'true') $sql_data_array['entry_company'] = $entry_company; if (ACCOUNT_OWNER == 'true') $sql_data_array['entry_owner'] = $entry_owner; if (ACCOUNT_VAT_ID == 'true') { $sql_data_array['entry_vat_id'] = $entry_vat_id; $sql_data_array['entry_vat_id_status'] = $entry_vat_id_status; } if (ACCOUNT_STATE == 'true') { $sql_data_array['entry_state'] = $entry_state; $sql_data_array['entry_zone_id'] = $entry_zone_id; } oos_db_perform($oostable['address_book'], $sql_data_array, 'UPDATE', "customers_id = '" . intval($customers_id) . "' and address_book_id = '" . oos_db_input($default_address_id) . "'"); oos_redirect_admin(oos_href_link_admin($aContents['customers'], oos_get_all_get_params(array('cID', 'action')) . 'cID=' . $customers_id)); break; case 'deleteconfirm': $customers_id = oos_db_prepare_input($_GET['cID']); if (isset($_POST['delete_reviews']) && ($_POST['delete_reviews'] == 'on')) { $reviewstable = $oostable['reviews']; $reviews_result = $dbconn->Execute("SELECT reviews_id FROM $reviewstable WHERE customers_id = '" . intval($customers_id) . "'"); while ($reviews = $reviews_result->fields) { $reviews_descriptiontable = $oostable['reviews_description']; $dbconn->Execute("DELETE FROM $reviews_descriptiontable WHERE reviews_id = '" . intval($reviews['reviews_id']) . "'"); // Move that ADOdb pointer! $reviews_result->MoveNext(); } $dbconn->Execute("DELETE FROM " . $oostable['reviews'] . " WHERE customers_id = '" . intval($customers_id) . "'"); } else { $dbconn->Execute("UPDATE " . $oostable['reviews'] . " SET customers_id = null WHERE customers_id = '" . intval($customers_id) . "'"); } $dbconn->Execute("DELETE FROM " . $oostable['address_book'] . " WHERE customers_id = '" . intval($customers_id) . "'"); $dbconn->Execute("DELETE FROM " . $oostable['customers'] . " WHERE customers_id = '" . intval($customers_id) . "'"); $dbconn->Execute("DELETE FROM " . $oostable['customers_info'] . " WHERE customers_info_id = '" . intval($customers_id) . "'"); $dbconn->Execute("DELETE FROM " . $oostable['customers_basket'] . " WHERE customers_id = '" . intval($customers_id) . "'"); $dbconn->Execute("DELETE FROM " . $oostable['customers_basket_attributes'] . " WHERE customers_id = '" . intval($customers_id) . "'"); $dbconn->Execute("DELETE FROM " . $oostable['customers_wishlist'] . " WHERE customers_id = '" . intval($customers_id) . "'"); $dbconn->Execute("DELETE FROM " . $oostable['customers_wishlist_attributes'] . " WHERE customers_id = '" . intval($customers_id) . "'"); $dbconn->Execute("DELETE FROM " . $oostable['customers_status_history'] . " WHERE customers_id = '" . intval($customers_id) . "'"); $dbconn->Execute("DELETE FROM " . $oostable['whos_online'] . " WHERE customer_id = '" . intval($customers_id) . "'"); oos_redirect_admin(oos_href_link_admin($aContents['customers'], oos_get_all_get_params(array('cID', 'action')))); break; } } require 'includes/header.php'; if ($action == 'edit') { ?>
Execute("SELECT c.customers_gender, c.customers_firstname, c.customers_lastname, c.customers_dob, c.customers_email_address, c.customers_wishlist_link_id, a.entry_company, a.entry_owner, a.entry_vat_id, a.entry_vat_id_status, a.entry_street_address, a.entry_postcode, a.entry_city, a.entry_state, a.entry_zone_id, a.entry_country_id, c.customers_telephone, c.customers_default_address_id, c.customers_status, c.customers_max_order FROM $customerstable c LEFT JOIN $address_booktable a ON c.customers_default_address_id = a.address_book_id WHERE a.customers_id = c.customers_id AND c.customers_id = '" . intval($_GET['cID']) . "'"); $customers = $customers_result->fields; $cInfo = new objectInfo($customers); $vat_id_status_array = array(array('id' => '1', 'text' => ENTRY_VAT_ID_STATUS_YES), array('id' => '0', 'text' => ENTRY_VAT_ID_STATUS_NO)); ?>

customers_firstname . ' ' . $cInfo->customers_lastname ; ?>

customers_default_address_id); ?>
' . HEADING_TITLE_STATUS; echo $customers_statuses_array[$customers['customers_status']]['text'] . ' - ' . $customers_statuses_array[$customers['customers_status']]['cs_ot_discount_flag']; ?>
customers_gender) . '  ' . MALE . '  ' . oos_draw_radio_field('customers_gender', 'f', false, $cInfo->customers_gender) . '  ' . FEMALE; ?>
customers_firstname, 'maxlength="32"', true); ?>
customers_lastname, 'maxlength="32"', true); ?>
customers_dob), 'maxlength="10"', true); ?>
customers_email_address, 'maxlength="96"', true); ?>
entry_company, 'maxlength="32"'); ?>
entry_owner, 'maxlength="32"'); ?>
entry_vat_id, 'maxlength="20"'); ?>
entry_vat_id_status); ?>
customers_max_order, 'maxlength="32"'); ?>
entry_street_address, 'maxlength="64"', true); ?>
entry_postcode, 'maxlength="8"', true); ?>
entry_city, 'maxlength="32"', true); ?>
entry_country_id, 'onChange="update_zone(this.form);"'); ?>
entry_country_id), $cInfo->entry_zone_id, 'onChange="resetStateText(this.form);"'); ?>
  entry_state, 'maxlength="32" onChange="resetZoneSelected(this.form);"'); ?>
customers_telephone, 'maxlength="32"', true); ?>
' . BUTTON_CANCEL . ''; ?>

'0', 'text' => TEXT_ALL_CUSTOMERS)), $customers_statuses_array), '0', 'onChange="this.form.submit();"'); ?>
'' . TEXT_INFO_HEADING_DELETE_CUSTOMER . ''); $contents = array('form' => oos_draw_form('id', 'customers', $aContents['customers'], oos_get_all_get_params(array('cID', 'action')) . 'cID=' . $cInfo->customers_id . '&action=deleteconfirm', 'post', FALSE)); $contents[] = array('text' => TEXT_DELETE_INTRO . '

' . $cInfo->customers_firstname . ' ' . $cInfo->customers_lastname . ''); if ($cInfo->number_of_reviews > 0) $contents[] = array('text' => '
' . oos_draw_checkbox_field('delete_reviews', 'on', true) . ' ' . sprintf(TEXT_DELETE_REVIEWS, $cInfo->number_of_reviews)); $contents[] = array('align' => 'center', 'text' => '
' . oos_submit_button(BUTTON_DELETE) . ' ' . BUTTON_CANCEL . ''); break; case 'editstatus': $heading[] = array('text' => '' . TEXT_INFO_HEADING_STATUS_CUSTOMER . ''); $contents = array('form' => oos_draw_form('id', 'customers', $aContents['customers'], oos_get_all_get_params(array('cID', 'action')) . 'cID=' . $cInfo->customers_id . '&action=statusconfirm', 'post', FALSE)); $contents[] = array('text' => '
' . oos_draw_pull_down_menu('pdm_status', array_merge(array(array('id' => '0', 'text' => PULL_DOWN_DEFAULT)), $customers_statuses_array), $cInfo->customers_status) ); $contents[] = array('text' => '
Execute($customers_result_raw); while ($customers = $customers_result->fields) { $customers_infotable = $oostable['customers_info']; $info_result = $dbconn->Execute("SELECT customers_info_date_account_created AS date_account_created, customers_info_date_account_last_modified AS date_account_last_modified, customers_info_date_of_last_logon AS date_last_logon, customers_info_number_of_logons AS number_of_logons FROM $customers_infotable WHERE customers_info_id = '" . $customers['customers_id'] . "'"); $info = $info_result->fields; if ((!isset($_GET['cID']) || (isset($_GET['cID']) && ($_GET['cID'] == $customers['customers_id']))) && !isset($cInfo)) { $countriestable = $oostable['countries']; $country_result = $dbconn->Execute("SELECT countries_name FROM $countriestable WHERE countries_id = '" . $customers['entry_country_id'] . "'"); $country = $country_result->fields; $reviewstable = $oostable['reviews']; $reviews_result = $dbconn->Execute("SELECT COUNT(*) AS number_of_reviews FROM $reviewstable WHERE customers_id = '" . $customers['customers_id'] . "'"); $reviews = $reviews_result->fields; $customer_info = array_merge($country, $info, $reviews); $cInfo_array = array_merge($customers, $customer_info); $cInfo = new objectInfo($cInfo_array); } if (isset($cInfo) && is_object($cInfo) && ($customers['customers_id'] == $cInfo->customers_id)) { echo ' ' . "\n"; } else { echo ' ' . "\n"; } ?> MoveNext(); } ?>
 
' . oos_image(OOS_IMAGES . 'icon_status_green.gif', IMAGE_ICON_STATUS_RED_LIGHT, 10, 10) . ''; } else { echo '' . oos_image(OOS_IMAGES . 'icon_status_red.gif', IMAGE_ICON_STATUS_GREEN_LIGHT, 10, 10) . ''; } ?> customers_id) ) { echo ''; } else { echo ''; } ?> 
display_count($customers_result_numrows, MAX_DISPLAY_SEARCH_RESULTS, $nPage, TEXT_DISPLAY_NUMBER_OF_CUSTOMERS); ?> display_links($customers_result_numrows, MAX_DISPLAY_SEARCH_RESULTS, MAX_DISPLAY_PAGE_LINKS, $nPage, oos_get_all_get_params(array('page', 'info', 'x', 'y', 'cID'))); ?>
' . oos_button(BUTTON_RESET) . ''; ?>
'); $customers_status_historytable = $oostable['customers_status_history']; $customers_history_sql = "SELECT new_value, old_value, date_added, customer_notified FROM $customers_status_historytable WHERE customers_id = '" . intval($cID) . "' ORDER BY customers_status_history_id DESC"; $customers_history_result = $dbconn->Execute($customers_history_sql); if ($customers_history_result->RecordCount()) { while ($customers_history = $customers_history_result->fields) { $contents[] = array('text' => '' . "\n" . '' . "\n" .'' . "\n" .'' . "\n"); // Move that ADOdb pointer! $customers_history_result->MoveNext(); } } else { $contents[] = array('text' => '' . "\n" . ' ' . "\n" . ' ' . "\n"); } $contents[] = array('text' => '
' . TABLE_HEADING_NEW_VALUE .' ' . TABLE_HEADING_DATE_ADDED . '
' . $customers_statuses_array[$customers_history['new_value']]['text'] . '' . oos_datetime_short($customers_history['date_added']) . ''); $contents[] = array('text' => '
' . TEXT_NO_CUSTOMER_HISTORY . '
'); $contents[] = array('align' => 'center', 'text' => '
' . oos_submit_button(IMAGE_UPDATE) . ' ' . BUTTON_CANCEL . ''); break; default: $customer_status = oos_get_customers_status ($cID); $cs_id = $customer_status['customers_status']; $cs_name = $customer_status['customers_status_name']; $cs_ot_discount_flag = $customer_status['customers_status_ot_discount_flag']; $cs_ot_discount = $customer_status['customers_status_ot_discount']; $cs_qty_discounts = $customer_status['customers_status_qty_discounts']; $cs_payment = $customer_status['customers_status_payment']; if (isset($cInfo) && is_object($cInfo)) { $heading[] = array('text' => '' . $cInfo->customers_firstname . ' ' . $cInfo->customers_lastname . ''); $contents[] = array('align' => 'center', 'text' => '' . oos_button(BUTTON_EDIT) . ' ' . oos_button(BUTTON_DELETE) . ' ' . oos_button(IMAGE_ORDERS) . ' ' . oos_button(IMAGE_EMAIL) . ''); $contents[] = array('align' => 'center', 'text' => '' . oos_button(IMAGE_WISHLIST) . ' ' . oos_button(IMAGE_STATUS) . ''); $manual_infotable = $oostable['manual_info']; $sql = "SELECT man_info_id, man_key, status FROM $manual_infotable WHERE man_info_id = '1'"; $login_result = $dbconn->Execute($sql); $login = $login_result->fields; if ($login['status'] != '0') { $contents[] = array('align' => 'center', 'text' => oos_draw_login_form('login', $aCatalog['login_admin'], 'action=login_admin', 'POST') . oos_draw_hidden_field('verif_key', $login['man_key']) . oos_draw_hidden_field('email_address', $cInfo->customers_email_address) . oos_submit_button(IMAGE_LOGIN) . ''); } $contents[] = array('text' => '
' . oos_customers_payment($customer_status['customers_status_payment'])); $contents[] = array('text' => '
' . TEXT_DATE_ACCOUNT_CREATED . ' ' . oos_date_short($cInfo->date_account_created)); $contents[] = array('text' => '
' . TEXT_DATE_ACCOUNT_LAST_MODIFIED . ' ' . oos_date_short($cInfo->date_account_last_modified)); $contents[] = array('text' => '
' . TEXT_INFO_DATE_LAST_LOGON . ' ' . oos_date_short($cInfo->date_last_logon)); $contents[] = array('text' => '
' . TEXT_INFO_NUMBER_OF_LOGONS . ' ' . $cInfo->number_of_logons); $contents[] = array('text' => '
' . TEXT_INFO_COUNTRY . ' ' . $cInfo->countries_name); $contents[] = array('text' => '
' . TEXT_INFO_NUMBER_OF_REVIEWS . ' ' . $cInfo->number_of_reviews); } break; } if ( (oos_is_not_null($heading)) && (oos_is_not_null($contents)) ) { ?> infoBox($heading, $contents); ?>