//
 //		$messageStack->add('checkout_alternative', ENTRY_PASSWORD_ERROR_NOT_MATCHING);
 //	}
 //	if ($customers_status == 0 || !$customers_status)
 $customers_status = DEFAULT_CUSTOMERS_STATUS_ID;
 if (!$newsletter) {
     $newsletter = 0;
 }
 if ($error == false) {
     $sql_data_array = array('customers_vat_id' => $vat, 'customers_vat_id_status' => $customers_vat_id_status, 'customers_status' => $customers_status, 'customers_firstname' => $firstname, 'customers_secondname' => $secondname, 'customers_lastname' => $lastname, 'customers_email_address' => $email_address, 'customers_telephone' => $telephone, 'customers_fax' => $fax, 'orig_reference' => $html_referer, 'customers_newsletter' => $newsletter, 'delete_user' => '0', 'account_type' => '0', 'customers_password' => vam_encrypt_password($password), 'customers_date_added' => 'now()', 'customers_last_modified' => 'now()');
     $_SESSION['account_type'] = '1';
     if (ACCOUNT_GENDER == 'true') {
         $sql_data_array['customers_gender'] = $gender;
     }
     if (ACCOUNT_DOB == 'true') {
         $sql_data_array['customers_dob'] = vam_date_raw($dob);
     }
     vam_db_perform(TABLE_CUSTOMERS, $sql_data_array);
     $_SESSION['customer_id'] = vam_db_insert_id();
     $extra_fields_query = vamDBquery("select ce.fields_id from " . TABLE_EXTRA_FIELDS . " ce where ce.fields_status=1 ");
     $customers_id = $_SESSION['customer_id'];
     $extra_fields_query = vam_db_query("select ce.fields_id from " . TABLE_EXTRA_FIELDS . " ce where ce.fields_status=1 ");
     while ($extra_fields = vam_db_fetch_array($extra_fields_query)) {
         if (isset($_POST['fields_' . $extra_fields['fields_id']])) {
             $sql_data_array = array('customers_id' => (int) $customers_id, 'fields_id' => $extra_fields['fields_id'], 'value' => $_POST['fields_' . $extra_fields['fields_id']]);
         } else {
             $sql_data_array = array('customers_id' => (int) $customers_id, 'fields_id' => $extra_fields['fields_id'], 'value' => '');
             $is_add = false;
             for ($i = 1; $i <= $_POST['fields_' . $extra_fields['fields_id'] . '_total']; $i++) {
                 if (isset($_POST['fields_' . $extra_fields['fields_id'] . '_' . $i])) {
                     if ($is_add) {
 $entry_company_taxid_error = false;
 // Check Payment
 $entry_payment_check_error = false;
 $entry_payment_paypal_error = false;
 $entry_payment_bank_name_error = false;
 $entry_payment_bank_branch_number_error = false;
 $entry_payment_bank_swift_code_error = false;
 $entry_payment_bank_account_name_error = false;
 $entry_payment_bank_account_number_error = false;
 if (!$error) {
     $sql_data_array = array('affiliate_firstname' => $a_firstname, 'affiliate_lastname' => $a_lastname, 'affiliate_email_address' => $a_email_address, 'affiliate_payment_check' => $a_payment_check, 'affiliate_payment_paypal' => $a_payment_paypal, 'affiliate_payment_bank_name' => $a_payment_bank_name, 'affiliate_payment_bank_branch_number' => $a_payment_bank_branch_number, 'affiliate_payment_bank_swift_code' => $a_payment_bank_swift_code, 'affiliate_payment_bank_account_name' => $a_payment_bank_account_name, 'affiliate_payment_bank_account_number' => $a_payment_bank_account_number, 'affiliate_street_address' => $a_street_address, 'affiliate_postcode' => $a_postcode, 'affiliate_city' => $a_city, 'affiliate_country_id' => $a_country, 'affiliate_telephone' => $a_telephone, 'affiliate_fax' => $a_fax, 'affiliate_homepage' => $a_homepage, 'affiliate_password' => vam_encrypt_password($a_password), 'affiliate_agb' => '1');
     if (ACCOUNT_GENDER == 'true') {
         $sql_data_array['affiliate_gender'] = $a_gender;
     }
     if (ACCOUNT_DOB == 'true') {
         $sql_data_array['affiliate_dob'] = vam_date_raw($a_dob);
     }
     if (ACCOUNT_COMPANY == 'true') {
         $sql_data_array['affiliate_company'] = $a_company;
         $sql_data_array['affiliate_company_taxid'] = $a_company_taxid;
     }
     if (ACCOUNT_SUBURB == 'true') {
         $sql_data_array['affiliate_suburb'] = $a_suburb;
     }
     if (ACCOUNT_STATE == 'true') {
         if ($a_zone_id > 0) {
             $sql_data_array['affiliate_zone_id'] = $a_zone_id;
             $sql_data_array['affiliate_state'] = '';
         } else {
             $sql_data_array['affiliate_zone_id'] = '0';
             $sql_data_array['affiliate_state'] = $a_state;