[phpBB Debug] PHP Warning: in file [ROOT]/includes/crs/crs_misc_functions.php on line 37: mime_content_type(): Empty filename or path
[phpBB Debug] PHP Warning: in file [ROOT]/includes/crs/crs_misc_functions.php on line 37: mime_content_type(): Empty filename or path
Zen Cart 源代码 create_account.php

Zen Cart 源代码 create_account.php




下载文件

文件名: create_account.php
文件类型: PHP文件
文件大小: 20.11 KiB
MD5: 06e29503646c7de2c5bae5d33447295d

create_account.php - 关闭高亮
  1. <?php
  2. /**
  3.  * create_account header_php.php
  4.  *
  5.  * @package modules
  6.  * @copyright Copyright 2003-2012 Zen Cart Development Team
  7.  * @copyright Portions Copyright 2003 osCommerce
  8.  * @license http://www.zen-cart.com/license/2_0.txt GNU Public License V2.0
  9.  * @version GIT: $Id: Author: DrByte  Sat Jul 21 16:05:31 2012 -0400 Modified in v1.5.1 $
  10.  */
  11. // This should be first line of the script:
  12. $zco_notifier->notify('NOTIFY_MODULE_START_CREATE_ACCOUNT');
  13.  
  14. if (!defined('IS_ADMIN_FLAG')) {
  15.   die('Illegal Access');
  16. }
  17. /**
  18.  * Set some defaults
  19.  */
  20.   $process = false;
  21.   $zone_name = '';
  22.   $entry_state_has_zones = '';
  23.   $error_state_input = false;
  24.   $state = '';
  25.   $zone_id = 0;
  26.   $error = false;
  27.   $email_format = (ACCOUNT_EMAIL_PREFERENCE == '1' ? 'HTML' : 'TEXT');
  28.   $newsletter = (ACCOUNT_NEWSLETTER_STATUS == '1' || ACCOUNT_NEWSLETTER_STATUS == '0' ? false : true);
  29.  
  30. /**
  31.  * Process form contents
  32.  */
  33. if (isset($_POST['action']) && ($_POST['action'] == 'process')) {
  34.   $process = true;
  35.   $antiSpam = isset($_POST['should_be_empty']) ? zen_db_prepare_input($_POST['should_be_empty']) : '';
  36.   $zco_notifier->notify('NOTIFY_CREATE_ACCOUNT_CAPTCHA_CHECK');
  37.  
  38.   if (ACCOUNT_GENDER == 'true') {
  39.     if (isset($_POST['gender'])) {
  40.       $gender = zen_db_prepare_input($_POST['gender']);
  41.     } else {
  42.       $gender = false;
  43.     }
  44.   }
  45.  
  46.   if (isset($_POST['email_format'])) {
  47.     $email_format = zen_db_prepare_input($_POST['email_format']);
  48.   }
  49.  
  50.   if (ACCOUNT_COMPANY == 'true') $company = zen_db_prepare_input($_POST['company']);
  51.   $firstname = zen_db_prepare_input(zen_sanitize_string($_POST['firstname']));
  52.   $lastname = zen_db_prepare_input(zen_sanitize_string($_POST['lastname']));
  53.   $nick = zen_db_prepare_input($_POST['nick']);
  54.   if (ACCOUNT_DOB == 'true') $dob = zen_db_prepare_input($_POST['dob']);
  55.   $email_address = zen_db_prepare_input($_POST['email_address']);
  56.   $street_address = zen_db_prepare_input($_POST['street_address']);
  57.   if (ACCOUNT_SUBURB == 'true') $suburb = zen_db_prepare_input($_POST['suburb']);
  58.   $postcode = zen_db_prepare_input($_POST['postcode']);
  59.   $city = zen_db_prepare_input($_POST['city']);
  60.   if (ACCOUNT_STATE == 'true') {
  61.     $state = zen_db_prepare_input($_POST['state']);
  62.     if (isset($_POST['zone_id'])) {
  63.       $zone_id = zen_db_prepare_input($_POST['zone_id']);
  64.     } else {
  65.       $zone_id = false;
  66.     }
  67.   }
  68.   $country = zen_db_prepare_input($_POST['zone_country_id']);
  69.   $telephone = zen_db_prepare_input($_POST['telephone']);
  70.   $fax = zen_db_prepare_input($_POST['fax']);
  71.   $customers_authorization = CUSTOMERS_APPROVAL_AUTHORIZATION;
  72.   $customers_referral = zen_db_prepare_input($_POST['customers_referral']);
  73.  
  74.   if (ACCOUNT_NEWSLETTER_STATUS == '1' || ACCOUNT_NEWSLETTER_STATUS == '2') {
  75.     $newsletter = 0;
  76.     if (isset($_POST['newsletter'])) {
  77.       $newsletter = zen_db_prepare_input($_POST['newsletter']);
  78.     }
  79.   }
  80.  
  81.   $password = zen_db_prepare_input($_POST['password']);
  82.   $confirmation = zen_db_prepare_input($_POST['confirmation']);
  83.  
  84.  
  85.   if (DISPLAY_PRIVACY_CONDITIONS == 'true') {
  86.     if (!isset($_POST['privacy_conditions']) || ($_POST['privacy_conditions'] != '1')) {
  87.       $error = true;
  88.       $messageStack->add('create_account', ERROR_PRIVACY_STATEMENT_NOT_ACCEPTED, 'error');
  89.     }
  90.   }
  91.  
  92.   if (ACCOUNT_GENDER == 'true') {
  93.     if ( ($gender != 'm') && ($gender != 'f') ) {
  94.       $error = true;
  95.       $messageStack->add('create_account', ENTRY_GENDER_ERROR);
  96.     }
  97.   }
  98.  
  99.   if (strlen($firstname) < ENTRY_FIRST_NAME_MIN_LENGTH) {
  100.     $error = true;
  101.     $messageStack->add('create_account', ENTRY_FIRST_NAME_ERROR);
  102.   }
  103.  
  104.   if (strlen($lastname) < ENTRY_LAST_NAME_MIN_LENGTH) {
  105.     $error = true;
  106.     $messageStack->add('create_account', ENTRY_LAST_NAME_ERROR);
  107.   }
  108.  
  109.   if (ACCOUNT_DOB == 'true') {
  110.     if (ENTRY_DOB_MIN_LENGTH > 0 or !empty($_POST['dob'])) {
  111.       if (substr_count($dob,'/') > 2 || checkdate((int)substr(zen_date_raw($dob), 4, 2), (int)substr(zen_date_raw($dob), 6, 2), (int)substr(zen_date_raw($dob), 0, 4)) == false) {
  112.         $error = true;
  113.         $messageStack->add('create_account', ENTRY_DATE_OF_BIRTH_ERROR);
  114.       }
  115.     }
  116.   }
  117.  
  118.   if (ACCOUNT_COMPANY == 'true') {
  119.     if ((int)ENTRY_COMPANY_MIN_LENGTH > 0 && strlen($company) < ENTRY_COMPANY_MIN_LENGTH) {
  120.       $error = true;
  121.       $messageStack->add('create_account', ENTRY_COMPANY_ERROR);
  122.     }
  123.   }
  124.  
  125.  
  126.   if (strlen($email_address) < ENTRY_EMAIL_ADDRESS_MIN_LENGTH) {
  127.     $error = true;
  128.     $messageStack->add('create_account', ENTRY_EMAIL_ADDRESS_ERROR);
  129.   } elseif (zen_validate_email($email_address) == false) {
  130.     $error = true;
  131.     $messageStack->add('create_account', ENTRY_EMAIL_ADDRESS_CHECK_ERROR);
  132.   } else {
  133.     $check_email_query = "select count(*) as total
  134.                            from " . TABLE_CUSTOMERS . "
  135.                            where customers_email_address = '" . zen_db_input($email_address) . "'";
  136.     $check_email = $db->Execute($check_email_query);
  137.  
  138.     if ($check_email->fields['total'] > 0) {
  139.       $error = true;
  140.       $messageStack->add('create_account', ENTRY_EMAIL_ADDRESS_ERROR_EXISTS);
  141.     }
  142.   }
  143.  
  144.   if ($phpBB && $phpBB->phpBB['installed'] == true) {
  145.     if (strlen($nick) < ENTRY_NICK_MIN_LENGTH)  {
  146.       $error = true;
  147.       $messageStack->add('create_account', ENTRY_NICK_LENGTH_ERROR);
  148.     } else {
  149.       // check Zen Cart for duplicate nickname
  150.       $sql = "select * from " . TABLE_CUSTOMERS  . "
  151.                           where customers_nick = :nick:";
  152.       $check_nick_query = $db->bindVars($sql, ':nick:', $nick, 'string');
  153.       $check_nick = $db->Execute($check_nick_query);
  154.       if ($check_nick->RecordCount() > 0 ) {
  155.         $error = true;
  156.         $messageStack->add('create_account', ENTRY_NICK_DUPLICATE_ERROR);
  157.       }
  158.       // check phpBB for duplicate nickname
  159.       if ($phpBB->phpbb_check_for_duplicate_nick($nick) == 'already_exists' ) {
  160.         $error = true;
  161.         $messageStack->add('create_account', ENTRY_NICK_DUPLICATE_ERROR . ' (phpBB)');
  162.       }
  163.     }
  164.   }
  165.  
  166.   if (strlen($street_address) < ENTRY_STREET_ADDRESS_MIN_LENGTH) {
  167.     $error = true;
  168.     $messageStack->add('create_account', ENTRY_STREET_ADDRESS_ERROR);
  169.   }
  170.  
  171.   if (strlen($city) < ENTRY_CITY_MIN_LENGTH) {
  172.     $error = true;
  173.     $messageStack->add('create_account', ENTRY_CITY_ERROR);
  174.   }
  175.  
  176.   if (ACCOUNT_STATE == 'true') {
  177.     $check_query = "SELECT count(*) AS total
  178.                    FROM " . TABLE_ZONES . "
  179.                    WHERE zone_country_id = :zoneCountryID";
  180.     $check_query = $db->bindVars($check_query, ':zoneCountryID', $country, 'integer');
  181.     $check = $db->Execute($check_query);
  182.     $entry_state_has_zones = ($check->fields['total'] > 0);
  183.     if ($entry_state_has_zones == true) {
  184.       $zone_query = "SELECT distinct zone_id, zone_name, zone_code
  185.                     FROM " . TABLE_ZONES . "
  186.                     WHERE zone_country_id = :zoneCountryID
  187.                     AND " .
  188.                      ((trim($state) != '' && $zone_id == 0) ? "(upper(zone_name) like ':zoneState%' OR upper(zone_code) like '%:zoneState%') OR " : "") .
  189.                     "zone_id = :zoneID
  190.                     ORDER BY zone_code ASC, zone_name";
  191.  
  192.       $zone_query = $db->bindVars($zone_query, ':zoneCountryID', $country, 'integer');
  193. // BOM by zen-cart.cn
  194.       $zone_query = $db->bindVars($zone_query, ':zoneState', GBcase($state,"upper"), 'noquotestring');
  195. // EOM by zen-cart.cn
  196.       $zone_query = $db->bindVars($zone_query, ':zoneID', $zone_id, 'integer');
  197.       $zone = $db->Execute($zone_query);
  198.  
  199.       //look for an exact match on zone ISO code
  200.       $found_exact_iso_match = ($zone->RecordCount() == 1);
  201.       if ($zone->RecordCount() > 1) {
  202.         while (!$zone->EOF && !$found_exact_iso_match) {
  203.           if (strtoupper($zone->fields['zone_code']) == strtoupper($state) ) {
  204.             $found_exact_iso_match = true;
  205.             continue;
  206.           }
  207.           $zone->MoveNext();
  208.         }
  209.       }
  210.  
  211.       if ($found_exact_iso_match) {
  212.         $zone_id = $zone->fields['zone_id'];
  213.         $zone_name = $zone->fields['zone_name'];
  214.       } else {
  215.         $error = true;
  216.         $error_state_input = true;
  217.         $messageStack->add('create_account', ENTRY_STATE_ERROR_SELECT);
  218.       }
  219.     } else {
  220.       if (strlen($state) < ENTRY_STATE_MIN_LENGTH) {
  221.         $error = true;
  222.         $error_state_input = true;
  223.         $messageStack->add('create_account', ENTRY_STATE_ERROR);
  224.       }
  225.     }
  226.   }
  227.  
  228.   if (strlen($postcode) < ENTRY_POSTCODE_MIN_LENGTH) {
  229.     $error = true;
  230.     $messageStack->add('create_account', ENTRY_POST_CODE_ERROR);
  231.   }
  232.  
  233.   if ( (is_numeric($country) == false) || ($country < 1) ) {
  234.     $error = true;
  235.     $messageStack->add('create_account', ENTRY_COUNTRY_ERROR);
  236.   }
  237.  
  238.   if (strlen($telephone) < ENTRY_TELEPHONE_MIN_LENGTH) {
  239.     $error = true;
  240.     $messageStack->add('create_account', ENTRY_TELEPHONE_NUMBER_ERROR);
  241.   }
  242.  
  243.  
  244.   if (strlen($password) < ENTRY_PASSWORD_MIN_LENGTH) {
  245.     $error = true;
  246.     $messageStack->add('create_account', ENTRY_PASSWORD_ERROR);
  247.   } elseif ($password != $confirmation) {
  248.     $error = true;
  249.     $messageStack->add('create_account', ENTRY_PASSWORD_ERROR_NOT_MATCHING);
  250.   }
  251.  
  252.   if ($error == true) {
  253.     // hook notifier class
  254.     $zco_notifier->notify('NOTIFY_FAILURE_DURING_CREATE_ACCOUNT');
  255.   } elseif ($antiSpam != '') {
  256.     $zco_notifier->notify('NOTIFY_SPAM_DETECTED_DURING_CREATE_ACCOUNT');
  257.     $messageStack->add_session('header', (defined('ERROR_CREATE_ACCOUNT_SPAM_DETECTED') ? ERROR_CREATE_ACCOUNT_SPAM_DETECTED : 'Thank you, your account request has been submitted for review.'), 'success');
  258.     zen_redirect(zen_href_link(FILENAME_SHOPPING_CART));
  259.   } else {
  260.     $sql_data_array = array('customers_firstname' => $firstname,
  261.                             'customers_lastname' => $lastname,
  262.                             'customers_email_address' => $email_address,
  263.                             'customers_nick' => $nick,
  264.                             'customers_telephone' => $telephone,
  265.                             'customers_fax' => $fax,
  266.                             'customers_newsletter' => (int)$newsletter,
  267.                             'customers_email_format' => $email_format,
  268.                             'customers_default_address_id' => 0,
  269.                             'customers_password' => zen_encrypt_password($password),
  270.                             'customers_authorization' => (int)CUSTOMERS_APPROVAL_AUTHORIZATION
  271.     );
  272.  
  273.     if ((CUSTOMERS_REFERRAL_STATUS == '2' and $customers_referral != '')) $sql_data_array['customers_referral'] = $customers_referral;
  274.     if (ACCOUNT_GENDER == 'true') $sql_data_array['customers_gender'] = $gender;
  275.     if (ACCOUNT_DOB == 'true') $sql_data_array['customers_dob'] = (empty($_POST['dob']) || $dob_entered == '0001-01-01 00:00:00' ? zen_db_prepare_input('0001-01-01 00:00:00') : zen_date_raw($_POST['dob']));
  276.  
  277.     zen_db_perform(TABLE_CUSTOMERS, $sql_data_array);
  278.  
  279.     $_SESSION['customer_id'] = $db->Insert_ID();
  280.  
  281.     $zco_notifier->notify('NOTIFY_MODULE_CREATE_ACCOUNT_ADDED_CUSTOMER_RECORD', array_merge(array('customer_id' => $_SESSION['customer_id']), $sql_data_array));
  282.  
  283.     $sql_data_array = array('customers_id' => $_SESSION['customer_id'],
  284.                             'entry_firstname' => $firstname,
  285.                             'entry_lastname' => $lastname,
  286.                             'entry_street_address' => $street_address,
  287.                             'entry_postcode' => $postcode,
  288.                             'entry_city' => $city,
  289.                             'entry_country_id' => $country);
  290.  
  291.     if (ACCOUNT_GENDER == 'true') $sql_data_array['entry_gender'] = $gender;
  292.     if (ACCOUNT_COMPANY == 'true') $sql_data_array['entry_company'] = $company;
  293.     if (ACCOUNT_SUBURB == 'true') $sql_data_array['entry_suburb'] = $suburb;
  294.     if (ACCOUNT_STATE == 'true') {
  295.       if ($zone_id > 0) {
  296.         $sql_data_array['entry_zone_id'] = $zone_id;
  297.         $sql_data_array['entry_state'] = '';
  298.       } else {
  299.         $sql_data_array['entry_zone_id'] = '0';
  300.         $sql_data_array['entry_state'] = $state;
  301.       }
  302.     }
  303.  
  304.     zen_db_perform(TABLE_ADDRESS_BOOK, $sql_data_array);
  305.  
  306.     $address_id = $db->Insert_ID();
  307.  
  308.     $zco_notifier->notify('NOTIFY_MODULE_CREATE_ACCOUNT_ADDED_ADDRESS_BOOK_RECORD', array_merge(array('address_id' => $address_id), $sql_data_array));
  309.  
  310.     $sql = "update " . TABLE_CUSTOMERS . "
  311.              set customers_default_address_id = '" . (int)$address_id . "'
  312.              where customers_id = '" . (int)$_SESSION['customer_id'] . "'";
  313.  
  314.     $db->Execute($sql);
  315.  
  316.     $sql = "insert into " . TABLE_CUSTOMERS_INFO . "
  317.                          (customers_info_id, customers_info_number_of_logons,
  318.                           customers_info_date_account_created, customers_info_date_of_last_logon)
  319.              values ('" . (int)$_SESSION['customer_id'] . "', '1', now(), now())";
  320.  
  321.     $db->Execute($sql);
  322.  
  323.     // phpBB create account
  324.     if ($phpBB->phpBB['installed'] == true) {
  325.       $phpBB->phpbb_create_account($nick, $password, $email_address);
  326.     }
  327.     // End phppBB create account
  328.  
  329.     if (SESSION_RECREATE == 'True') {
  330.       zen_session_recreate();
  331.     }
  332.  
  333.     $_SESSION['customer_first_name'] = $firstname;
  334.     $_SESSION['customer_default_address_id'] = $address_id;
  335.     $_SESSION['customer_country_id'] = $country;
  336.     $_SESSION['customer_zone_id'] = $zone_id;
  337.     $_SESSION['customers_authorization'] = $customers_authorization;
  338.  
  339.     // restore cart contents
  340.     $_SESSION['cart']->restore_contents();
  341.  
  342.     // hook notifier class
  343.     $zco_notifier->notify('NOTIFY_LOGIN_SUCCESS_VIA_CREATE_ACCOUNT');
  344.  
  345.     // build the message content
  346.     $name = $firstname . ' ' . $lastname;
  347.  
  348.     if (ACCOUNT_GENDER == 'true') {
  349.       if ($gender == 'm') {
  350.         $email_text = sprintf(EMAIL_GREET_MR, $lastname);
  351.       } else {
  352.         $email_text = sprintf(EMAIL_GREET_MS, $lastname);
  353.       }
  354.     } else {
  355.       $email_text = sprintf(EMAIL_GREET_NONE, $firstname);
  356.     }
  357.     $html_msg['EMAIL_GREETING'] = str_replace('\n','',$email_text);
  358.     $html_msg['EMAIL_FIRST_NAME'] = $firstname;
  359.     $html_msg['EMAIL_LAST_NAME']  = $lastname;
  360.  
  361.     // initial welcome
  362.     $email_text .=  EMAIL_WELCOME;
  363.     $html_msg['EMAIL_WELCOME'] = str_replace('\n','',EMAIL_WELCOME);
  364.  
  365.     if (NEW_SIGNUP_DISCOUNT_COUPON != '' and NEW_SIGNUP_DISCOUNT_COUPON != '0') {
  366.       $coupon_id = NEW_SIGNUP_DISCOUNT_COUPON;
  367.       $coupon = $db->Execute("select * from " . TABLE_COUPONS . " where coupon_id = '" . $coupon_id . "'");
  368.       $coupon_desc = $db->Execute("select coupon_description from " . TABLE_COUPONS_DESCRIPTION . " where coupon_id = '" . $coupon_id . "' and language_id = '" . $_SESSION['languages_id'] . "'");
  369.       $db->Execute("insert into " . TABLE_COUPON_EMAIL_TRACK . " (coupon_id, customer_id_sent, sent_firstname, emailed_to, date_sent) values ('" . $coupon_id ."', '0', 'Admin', '" . $email_address . "', now() )");
  370.  
  371.       $text_coupon_help = sprintf(TEXT_COUPON_HELP_DATE, zen_date_short($coupon->fields['coupon_start_date']),zen_date_short($coupon->fields['coupon_expire_date']));
  372.  
  373.       // if on, add in Discount Coupon explanation
  374.       //        $email_text .= EMAIL_COUPON_INCENTIVE_HEADER .
  375.       $email_text .= "\n" . EMAIL_COUPON_INCENTIVE_HEADER .
  376.       (!empty($coupon_desc->fields['coupon_description']) ? $coupon_desc->fields['coupon_description'] . "\n\n" : '') . $text_coupon_help  . "\n\n" .
  377.       strip_tags(sprintf(EMAIL_COUPON_REDEEM, ' ' . $coupon->fields['coupon_code'])) . EMAIL_SEPARATOR;
  378.  
  379.       $html_msg['COUPON_TEXT_VOUCHER_IS'] = EMAIL_COUPON_INCENTIVE_HEADER ;
  380.       $html_msg['COUPON_DESCRIPTION']     = (!empty($coupon_desc->fields['coupon_description']) ? '<strong>' . $coupon_desc->fields['coupon_description'] . '</strong>' : '');
  381.       $html_msg['COUPON_TEXT_TO_REDEEM']  = str_replace("\n", '', sprintf(EMAIL_COUPON_REDEEM, ''));
  382.       $html_msg['COUPON_CODE']  = $coupon->fields['coupon_code'] . $text_coupon_help;
  383.     } //endif coupon
  384.  
  385.     if (NEW_SIGNUP_GIFT_VOUCHER_AMOUNT > 0) {
  386.       $coupon_code = zen_create_coupon_code();
  387.       $insert_query = $db->Execute("insert into " . TABLE_COUPONS . " (coupon_code, coupon_type, coupon_amount, date_created) values ('" . $coupon_code . "', 'G', '" . NEW_SIGNUP_GIFT_VOUCHER_AMOUNT . "', now())");
  388.       $insert_id = $db->Insert_ID();
  389.       $db->Execute("insert into " . TABLE_COUPON_EMAIL_TRACK . " (coupon_id, customer_id_sent, sent_firstname, emailed_to, date_sent) values ('" . $insert_id ."', '0', 'Admin', '" . $email_address . "', now() )");
  390.  
  391.       // if on, add in GV explanation
  392.       $email_text .= "\n\n" . sprintf(EMAIL_GV_INCENTIVE_HEADER, $currencies->format(NEW_SIGNUP_GIFT_VOUCHER_AMOUNT)) .
  393.       sprintf(EMAIL_GV_REDEEM, $coupon_code) .
  394.       EMAIL_GV_LINK . zen_href_link(FILENAME_GV_REDEEM, 'gv_no=' . $coupon_code, 'NONSSL', false) . "\n\n" .
  395.       EMAIL_GV_LINK_OTHER . EMAIL_SEPARATOR;
  396.       $html_msg['GV_WORTH'] = str_replace('\n','',sprintf(EMAIL_GV_INCENTIVE_HEADER, $currencies->format(NEW_SIGNUP_GIFT_VOUCHER_AMOUNT)) );
  397.       $html_msg['GV_REDEEM'] = str_replace('\n','',str_replace('\n\n','<br />',sprintf(EMAIL_GV_REDEEM, '<strong>' . $coupon_code . '</strong>')));
  398.       $html_msg['GV_CODE_NUM'] = $coupon_code;
  399.       $html_msg['GV_CODE_URL'] = str_replace('\n','',EMAIL_GV_LINK . '<a href="' . zen_href_link(FILENAME_GV_REDEEM, 'gv_no=' . $coupon_code, 'NONSSL', false) . '">' . TEXT_GV_NAME . ': ' . $coupon_code . '</a>');
  400.       $html_msg['GV_LINK_OTHER'] = EMAIL_GV_LINK_OTHER;
  401.     } // endif voucher
  402.  
  403.     // add in regular email welcome text
  404.     $email_text .= "\n\n" . EMAIL_TEXT . EMAIL_CONTACT . EMAIL_GV_CLOSURE;
  405.  
  406.     $html_msg['EMAIL_MESSAGE_HTML']  = str_replace('\n','',EMAIL_TEXT);
  407.     $html_msg['EMAIL_CONTACT_OWNER'] = str_replace('\n','',EMAIL_CONTACT);
  408.     $html_msg['EMAIL_CLOSURE']       = nl2br(EMAIL_GV_CLOSURE);
  409.  
  410.     // include create-account-specific disclaimer
  411.     $email_text .= "\n\n" . sprintf(EMAIL_DISCLAIMER_NEW_CUSTOMER, STORE_OWNER_EMAIL_ADDRESS). "\n\n";
  412.     $html_msg['EMAIL_DISCLAIMER'] = sprintf(EMAIL_DISCLAIMER_NEW_CUSTOMER, '<a href="mailto:' . STORE_OWNER_EMAIL_ADDRESS . '">'. STORE_OWNER_EMAIL_ADDRESS .' </a>');
  413.  
  414.     // send welcome email
  415.     if (trim(EMAIL_SUBJECT) != 'n/a') zen_mail($name, $email_address, EMAIL_SUBJECT, $email_text, STORE_NAME, EMAIL_FROM, $html_msg, 'welcome');
  416.  
  417.     // send additional emails
  418.     if (SEND_EXTRA_CREATE_ACCOUNT_EMAILS_TO_STATUS == '1' and SEND_EXTRA_CREATE_ACCOUNT_EMAILS_TO !='') {
  419.       if ($_SESSION['customer_id']) {
  420.         $account_query = "select customers_firstname, customers_lastname, customers_email_address, customers_telephone, customers_fax
  421.                            from " . TABLE_CUSTOMERS . "
  422.                            where customers_id = '" . (int)$_SESSION['customer_id'] . "'";
  423.  
  424.         $account = $db->Execute($account_query);
  425.       }
  426.  
  427.       $extra_info=email_collect_extra_info($name,$email_address, $account->fields['customers_firstname'] . ' ' . $account->fields['customers_lastname'], $account->fields['customers_email_address'], $account->fields['customers_telephone'], $account->fields['customers_fax']);
  428.       $html_msg['EXTRA_INFO'] = $extra_info['HTML'];
  429.       if (trim(SEND_EXTRA_CREATE_ACCOUNT_EMAILS_TO_SUBJECT) != 'n/a') zen_mail('', SEND_EXTRA_CREATE_ACCOUNT_EMAILS_TO, SEND_EXTRA_CREATE_ACCOUNT_EMAILS_TO_SUBJECT . ' ' . EMAIL_SUBJECT,
  430.       $email_text . $extra_info['TEXT'], STORE_NAME, EMAIL_FROM, $html_msg, 'welcome_extra');
  431.     } //endif send extra emails
  432.  
  433.     zen_redirect(zen_href_link(FILENAME_CREATE_ACCOUNT_SUCCESS, '', 'SSL'));
  434.  
  435.   } //endif !error
  436. }
  437.  
  438.  
  439. /*
  440.  * Set flags for template use:
  441.  */
  442.   $selected_country = (isset($_POST['zone_country_id']) && $_POST['zone_country_id'] != '') ? $country : SHOW_CREATE_ACCOUNT_DEFAULT_COUNTRY;
  443.   $flag_show_pulldown_states = ((($process == true || $entry_state_has_zones == true) && $zone_name == '') || ACCOUNT_STATE_DRAW_INITIAL_DROPDOWN == 'true' || $error_state_input) ? true : false;
  444.   $state = ($flag_show_pulldown_states) ? ($state == '' ? '&nbsp;' : $state) : $zone_name;
  445.   $state_field_label = ($flag_show_pulldown_states) ? '' : ENTRY_STATE;
  446.  
  447. // This should be last line of the script:
  448. $zco_notifier->notify('NOTIFY_MODULE_END_CREATE_ACCOUNT');
  449.