count_contents() < 1) tep_redirect(tep_href_link(FILENAME_SHOPPING_CART)); // PWA BOF // needs to be included earlier to set the success message in the messageStack require(DIR_WS_LANGUAGES . $language . '/' . FILENAME_CREATE_ACCOUNT); $process = false; if (isset($HTTP_POST_VARS['action']) && ($HTTP_POST_VARS['action'] == 'process')) { $process = true; if (ACCOUNT_GENDER == 'true') { if (isset($HTTP_POST_VARS['gender'])) { $gender = tep_db_prepare_input($HTTP_POST_VARS['gender']); } else { $gender = false; } } $firstname = tep_db_prepare_input($HTTP_POST_VARS['firstname']); $lastname = tep_db_prepare_input($HTTP_POST_VARS['lastname']); if (ACCOUNT_DOB == 'true') $dob = tep_db_prepare_input($HTTP_POST_VARS['dob']); $email_address = tep_db_prepare_input($HTTP_POST_VARS['email_address']); $cf = tep_db_prepare_input($HTTP_POST_VARS['cf']); // BOF Separate Pricing Per Customer, added: field for tax id number if (ACCOUNT_COMPANY == 'true') { $company = tep_db_prepare_input($_POST['company']); //$company_tax_id = tep_db_prepare_input($_POST['company_tax_id']); $piva = tep_db_prepare_input($HTTP_POST_VARS['piva']); } // EOF Separate Pricing Per Customer, added: field for tax id number $street_address = tep_db_prepare_input($HTTP_POST_VARS['street_address']); if (ACCOUNT_SUBURB == 'true') $suburb = tep_db_prepare_input($HTTP_POST_VARS['suburb']); $postcode = tep_db_prepare_input($HTTP_POST_VARS['postcode']); $city = tep_db_prepare_input($HTTP_POST_VARS['city']); if (ACCOUNT_STATE == 'true') { $state = tep_db_prepare_input($HTTP_POST_VARS['state']); if (isset($HTTP_POST_VARS['zone_id'])) { $zone_id = tep_db_prepare_input($HTTP_POST_VARS['zone_id']); } else { $zone_id = false; } } $country = tep_db_prepare_input($HTTP_POST_VARS['country']); $telephone = tep_db_prepare_input($HTTP_POST_VARS['telephone']); $fax = tep_db_prepare_input($HTTP_POST_VARS['fax']); if (isset($HTTP_POST_VARS['newsletter'])) { $newsletter = tep_db_prepare_input($HTTP_POST_VARS['newsletter']); } else { $newsletter = false; } $password = tep_db_prepare_input($HTTP_POST_VARS['password']); $confirmation = tep_db_prepare_input($HTTP_POST_VARS['confirmation']); $error = false; //----- BEGINNING OF ADDITION: MATC -----// if (tep_db_prepare_input($HTTP_POST_VARS['TermsAgree']) != 'true' and MATC_AT_REGISTER != 'false') { $error = true; $messageStack->add('create_account', MATC_ERROR); } //----- END OF ADDITION: MATC -----// if (ACCOUNT_GENDER == 'true') { if ( ($gender != 'm') && ($gender != 'f') ) { $error = true; $messageStack->add('create_account', ENTRY_GENDER_ERROR); } } if (strlen($firstname) < ENTRY_FIRST_NAME_MIN_LENGTH) { $error = true; $messageStack->add('create_account', ENTRY_FIRST_NAME_ERROR); } if (strlen($lastname) < ENTRY_LAST_NAME_MIN_LENGTH) { $error = true; $messageStack->add('create_account', ENTRY_LAST_NAME_ERROR); } if (ACCOUNT_DOB == 'true') { if (checkdate(substr(tep_date_raw($dob), 6, 2), substr(tep_date_raw($dob), 4, 2), substr(tep_date_raw($dob), 0, 4)) == false) { $error = true; $messageStack->add('create_account', ENTRY_DATE_OF_BIRTH_ERROR); } } if (strlen($email_address) < ENTRY_EMAIL_ADDRESS_MIN_LENGTH) { $error = true; $messageStack->add('create_account', ENTRY_EMAIL_ADDRESS_ERROR); } elseif (tep_validate_email($email_address) == false) { $error = true; $messageStack->add('create_account', ENTRY_EMAIL_ADDRESS_CHECK_ERROR); } else { // PWA BOF 2b $check_email_query = tep_db_query("select count(*) as total from " . TABLE_CUSTOMERS . " where customers_email_address = '" . tep_db_input($email_address) . "' and guest_account != '1'"); // PWA EOF 2b $check_email = tep_db_fetch_array($check_email_query); if ($check_email['total'] > 0) { $error = true; $messageStack->add('create_account', ENTRY_EMAIL_ADDRESS_ERROR_EXISTS); } } if (strlen($cf) < ENTRY_CF_MIN_LENGTH) { $error = true; $messageStack->add('create_account', ENTRY_CF_ERROR); } if (strlen($street_address) < ENTRY_STREET_ADDRESS_MIN_LENGTH) { $error = true; $messageStack->add('create_account', ENTRY_STREET_ADDRESS_ERROR); } if (strlen($postcode) < ENTRY_POSTCODE_MIN_LENGTH) { $error = true; $messageStack->add('create_account', ENTRY_POST_CODE_ERROR); } if (strlen($city) < ENTRY_CITY_MIN_LENGTH) { $error = true; $messageStack->add('create_account', ENTRY_CITY_ERROR); } if (is_numeric($country) == false) { $error = true; $messageStack->add('create_account', ENTRY_COUNTRY_ERROR); } if (ACCOUNT_STATE == 'true') { // +Country-State Selector if ($zone_id == 0) { // -Country-State Selector if (strlen($state) < ENTRY_STATE_MIN_LENGTH) { $error = true; $messageStack->add('create_account', ENTRY_STATE_ERROR); } } } if (strlen($telephone) < ENTRY_TELEPHONE_MIN_LENGTH) { $error = true; $messageStack->add('create_account', ENTRY_TELEPHONE_NUMBER_ERROR); } // PWA BOF if (!isset($HTTP_GET_VARS['guest']) && !isset($HTTP_POST_VARS['guest'])) { // PWA EOF if (strlen($password) < ENTRY_PASSWORD_MIN_LENGTH) { $error = true; $messageStack->add('create_account', ENTRY_PASSWORD_ERROR); } elseif ($password != $confirmation) { $error = true; $messageStack->add('create_account', ENTRY_PASSWORD_ERROR_NOT_MATCHING); } // PWA BOF } // PWA EOF if ($error == false) { // PWA BOF 2b if (!isset($HTTP_GET_VARS['guest']) && !isset($HTTP_POST_VARS['guest'])) { $dbPass = tep_encrypt_password($password); $guestaccount = '0'; }else{ $dbPass = 'null'; $guestaccount = '1'; } // PWA EOF 2b $sql_data_array = array('customers_firstname' => $firstname, 'customers_lastname' => $lastname, 'customers_email_address' => $email_address, 'customers_cf' => $cf, 'customers_telephone' => $telephone, 'customers_fax' => $fax, 'customers_newsletter' => $newsletter, // PWA BOF 2b 'customers_password' => $dbPass, 'guest_account' => $guestaccount); // PWA EOF 2b if (ACCOUNT_GENDER == 'true') $sql_data_array['customers_gender'] = $gender; if (ACCOUNT_DOB == 'true') $sql_data_array['customers_dob'] = tep_date_raw($dob); tep_db_perform(TABLE_CUSTOMERS, $sql_data_array); $customer_id = tep_db_insert_id(); $sql_data_array = array('customers_id' => $customer_id, 'entry_firstname' => $firstname, 'entry_lastname' => $lastname, 'entry_street_address' => $street_address, 'entry_postcode' => $postcode, 'entry_city' => $city, 'entry_country_id' => $country); if (ACCOUNT_GENDER == 'true') $sql_data_array['entry_gender'] = $gender; if (ACCOUNT_COMPANY == 'true') { $sql_data_array['entry_company'] = $company; $sql_data_array['entry_piva'] = $piva; } if (ACCOUNT_SUBURB == 'true') $sql_data_array['entry_suburb'] = $suburb; if (ACCOUNT_STATE == 'true') { if ($zone_id > 0) { $sql_data_array['entry_zone_id'] = $zone_id; $sql_data_array['entry_state'] = ''; } else { $sql_data_array['entry_zone_id'] = '0'; $sql_data_array['entry_state'] = $state; } } // PWA BOF if (isset($HTTP_GET_VARS['guest']) or isset($HTTP_POST_VARS['guest'])) tep_session_register('customer_is_guest'); // PWA EOF tep_db_perform(TABLE_ADDRESS_BOOK, $sql_data_array); $address_id = tep_db_insert_id(); tep_db_query("update " . TABLE_CUSTOMERS . " set customers_default_address_id = '" . (int)$address_id . "' where customers_id = '" . (int)$customer_id . "'"); tep_db_query("insert into " . TABLE_CUSTOMERS_INFO . " (customers_info_id, customers_info_number_of_logons, customers_info_date_account_created) values ('" . (int)$customer_id . "', '0', now())"); if (SESSION_RECREATE == 'True') { tep_session_recreate(); } // BOF Separate Pricing Per Customer // register SPPC session variables for the new customer // if there is code above that puts new customers directly into another customer group (default is retail) // then the below code need not be changed, it uses the newly inserted customer group $check_customer_group_info = tep_db_query("select c.customers_group_id, cg.customers_group_show_tax, cg.customers_group_tax_exempt, cg.group_specific_taxes_exempt from " . TABLE_CUSTOMERS . " c left join " . TABLE_CUSTOMERS_GROUPS . " cg using(customers_group_id) where c.customers_id = '" . $customer_id . "'"); $customer_group_info = tep_db_fetch_array($check_customer_group_info); $sppc_customer_group_id = $customer_group_info['customers_group_id']; $sppc_customer_group_show_tax = (int)$customer_group_info['customers_group_show_tax']; $sppc_customer_group_tax_exempt = (int)$customer_group_info['customers_group_tax_exempt']; $sppc_customer_specific_taxes_exempt = ''; if (tep_not_null($customer_group_info['group_specific_taxes_exempt'])) { $sppc_customer_specific_taxes_exempt = $customer_group_info['group_specific_taxes_exempt']; } // EOF Separate Pricing Per Customer $customer_first_name = $firstname; $customer_default_address_id = $address_id; $customer_country_id = $country; $customer_zone_id = $zone_id; tep_session_register('customer_id'); tep_session_register('customer_first_name'); tep_session_register('customer_default_address_id'); tep_session_register('customer_country_id'); tep_session_register('customer_zone_id'); // BOF Separate Pricing Per Customer tep_session_register('sppc_customer_group_id'); tep_session_register('sppc_customer_group_show_tax'); tep_session_register('sppc_customer_group_tax_exempt'); tep_session_register('sppc_customer_specific_taxes_exempt'); // EOF Separate Pricing Per Customer // PWA BOF if (isset($HTTP_GET_VARS['guest']) or isset($HTTP_POST_VARS['guest'])) tep_redirect(tep_href_link(FILENAME_CHECKOUT_SHIPPING)); // PWA EOF // restore cart contents $cart->restore_contents(); // BEGIN SEND HTML MAIL// $name = $firstname . " " . $lastname; $Varlogo = ' '.VARLOGO.' ' ; $Vartable1 = ' '.VARTABLE1.' ' ; $Vartable2 = ' '.VARTABLE2.' ' ; $Vartextmail = EMAILWELCOME . EMAILTEXT . EMAILCONTACT . EMAILWARNING; $Vartrcolor = ' '. TRCOLOR . ' ' ; $Varmailfooter = ' ' . EMAIL_TEXT_FOOTER . '

' ; if (ACCOUNT_GENDER == 'true') { if ($HTTP_POST_VARS['gender'] == 'm') { $Vargendertext = EMAILGREET_MR; } else { $Vargendertext = EMAILGREET_MS; } } else { $Vargendertext = EMAILGREET_NONE; } require(DIR_WS_MODULES . 'email/html_create_account.php'); $email_text = $html_email_text ; if (EMAIL_USE_HTML == 'true') { $email_text; } else { if (ACCOUNT_GENDER == 'true') { if ($HTTP_POST_VARS['gender'] == 'm') { $email_text = EMAILGREET_MR; } else { $email_text = EMAILGREET_MS; } } else { $email_text = EMAILGREET_NONE; } $email_text .= EMAILWELCOME . "\n\n" . EMAILTEXT ."\n\n" . EMAILCONTACT . EMAIL_TEXT_FOOTER . "\n\n\n" . EMAIL_SEPARATOR . "\n" . EMAILWARNING . "\n\n" ; $email_text .= HTTP_SERVER . DIR_WS_CATALOG . "\n" . EMAIL_TEXT_FOOTERR . "\n" ; } //END SEND HTML EMAIL// // Skips create account success - Begin tep_mail($name, $email_address, EMAIL_SUBJECT, $email_text, STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS); // BOF Separate Pricing Per Customer: alert shop owner of account created by a company // if you would like to have an email when either a company name has been entered in // the appropriate field or a tax id number, or both then uncomment the next line and comment the default // setting: only email when a tax_id number has been given // if ( (ACCOUNT_COMPANY == 'true' && tep_not_null($company) ) || (ACCOUNT_COMPANY == 'true' && tep_not_null($company_tax_id) ) ) { if ( ACCOUNT_COMPANY == 'true' && tep_not_null($company_tax_id) ) { $alert_email_text = "Please note that " . $firstname . " " . $lastname . " of the company: " . $company . " has created an account."; tep_mail(STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS, 'Company account created', $alert_email_text, STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS); } // EOF Separate Pricing Per Customer: alert shop owner of account created by a company if ($cart->count_contents() == 0) { tep_redirect(tep_href_link(FILENAME_CREATE_ACCOUNT_SUCCESS, '', 'SSL')); } else { tep_redirect(tep_href_link(FILENAME_CHECKOUT_SHIPPING, '', 'SSL')); } } } // Skips create account success - End // PWA BOF if (!isset($HTTP_GET_VARS['guest']) && !isset($HTTP_POST_VARS['guest'])){ // +Country-State Selector if (!isset($country)) $country = DEFAULT_COUNTRY; // -Country-State Selector $breadcrumb->add(NAVBAR_TITLE, tep_href_link(FILENAME_CREATE_ACCOUNT, '', 'SSL')); }else{ $breadcrumb->add(NAVBAR_TITLE_PWA, tep_href_link(FILENAME_CREATE_ACCOUNT, 'guest=guest', 'SSL')); } // PWA EOF ?> > <?php echo TITLE; ?>
size('create_account') > 0) { ?>

output('create_account'); ?>
' . ENTRY_GENDER_TEXT . '': ''); ?>
' . ENTRY_FIRST_NAME_TEXT . '': ''); ?>
' . ENTRY_LAST_NAME_TEXT . '': ''); ?>
' . ENTRY_DATE_OF_BIRTH_TEXT . '': ''); ?>
' . ENTRY_EMAIL_ADDRESS_TEXT . '': ''); ?>
' . ENTRY_CF_TEXT . '': ''); ?>
' . ENTRY_COMPANY_TEXT . '': ''); ?>
' . ENTRY_COMPANY_PIVA_TEXT . '': ''); ?>
' . ENTRY_STREET_ADDRESS_TEXT . '': ''); ?>
' . ENTRY_SUBURB_TEXT . '': ''); ?>
' . ENTRY_POST_CODE_TEXT . '': ''); ?>
' . ENTRY_CITY_TEXT . '': ''); ?>
' . ENTRY_COUNTRY_TEXT . '': ''); ?>
' . ENTRY_TELEPHONE_NUMBER_TEXT . '': ''); ?>
' . ENTRY_FAX_NUMBER_TEXT . '': ''); ?>
' . ENTRY_NEWSLETTER_TEXT . '': ''); ?>
' . ENTRY_PASSWORD_TEXT . '': ''); ?>
' . ENTRY_PASSWORD_CONFIRMATION_TEXT . '': ''); ?>