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), 4, 2), substr(tep_date_raw($dob), 6, 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 {
$check_email_query = tep_db_query("select count(*) as total from " . TABLE_CUSTOMERS . " where customers_email_address = '" . tep_db_input($email_address) . "'");
$check_email = tep_db_fetch_array($check_email_query);
// DDB - 040616 - PWA
// if ($check_email['total'] > 0) {
// $error = true;
// $messageStack->add('create_account', ENTRY_EMAIL_ADDRESS_ERROR_EXISTS);
// }
if ($check_email['total'] > 0)
{ //PWA delete account
$get_customer_info = tep_db_query("select customers_id, customers_email_address, purchased_without_account from " . TABLE_CUSTOMERS . " where customers_email_address = '" . tep_db_input($email_address) . "'");
$customer_info = tep_db_fetch_array($get_customer_info);
$customer_id = $customer_info['customers_id'];
$customer_email_address = $customer_info['customers_email_address'];
$customer_pwa = $customer_info['purchased_without_account'];
if ($customer_pwa !='1')
{
$error = true;
$messageStack->add('create_account', ENTRY_EMAIL_ADDRESS_ERROR_EXISTS);
} else {
tep_db_query("delete from " . TABLE_ADDRESS_BOOK . " where customers_id = '" . $customer_id . "'");
tep_db_query("delete from " . TABLE_CUSTOMERS . " where customers_id = '" . $customer_id . "'");
tep_db_query("delete from " . TABLE_CUSTOMERS_INFO . " where customers_info_id = '" . $customer_id . "'");
tep_db_query("delete from " . TABLE_CUSTOMERS_BASKET . " where customers_id = '" . $customer_id . "'");
tep_db_query("delete from " . TABLE_CUSTOMERS_BASKET_ATTRIBUTES . " where customers_id = '" . $customer_id . "'");
tep_db_query("delete from " . TABLE_WHOS_ONLINE . " where customer_id = '" . $customer_id . "'");
}
}
// END
}
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') {
$zone_id = 0;
$check_query = tep_db_query("select count(*) as total from " . TABLE_ZONES . " where zone_country_id = '" . (int)$country . "'");
$check = tep_db_fetch_array($check_query);
$entry_state_has_zones = ($check['total'] > 0);
if ($entry_state_has_zones == true) {
$zone_query = tep_db_query("select distinct zone_id from " . TABLE_ZONES . " where zone_country_id = '" . (int)$country . "' and (zone_name like '" . tep_db_input($state) . "%' or zone_code like '%" . tep_db_input($state) . "%')");
if (tep_db_num_rows($zone_query) == 1) {
$zone = tep_db_fetch_array($zone_query);
$zone_id = $zone['zone_id'];
} else {
$error = true;
$messageStack->add('create_account', ENTRY_STATE_ERROR_SELECT);
}
} else {
if (strlen($state) < ENTRY_STATE_MIN_LENGTH) {
$error = true;
$messageStack->add('create_account', ENTRY_STATE_ERROR);
}
}
}
if (ENTRY_TELEPHONE_MIN_LENGTH !='0')
{
if (strlen($telephone) < ENTRY_TELEPHONE_MIN_LENGTH) {
$error = true;
$messageStack->add('create_account', ENTRY_TELEPHONE_NUMBER_ERROR);
}
}
// BOF Anti Robotic Registration v3.0
$validated = $_POST['validated'];
if (ACCOUNT_VALIDATION == 'true' && ACCOUNT_CREATE_VALIDATION == 'true') {
include(DIR_WS_MODULES . FILENAME_CHECK_VALIDATION);
if ($entry_antirobotreg_error == true) $messageStack->add('create_account', $text_antirobotreg_error);
}
// EOF Anti Robotic Registration v3.0
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);
}
if (SHOW_PRIVACY_STATEMENT == 'true') {
if ( ($error == false) && (!isset($HTTP_POST_VARS['agree'])) ) {
$error = true;
$messageStack->add('create_account', ENTRY_PRIVACY_AGREEMENT_ERROR);
}
}
if ($error == false) {
$sql_data_array = array('customers_firstname' => $firstname,
'customers_lastname' => $lastname,
'customers_email_address' => $email_address,
'customers_telephone' => $telephone,
'customers_fax' => $fax,
'customers_newsletter' => $newsletter,
'customers_password' => tep_encrypt_password($password));
if (ACCOUNT_GENDER == 'true') $sql_data_array['customers_gender'] = $gender;
if (ACCOUNT_DOB == 'true') $sql_data_array['customers_dob'] = tep_date_raw($dob);
// BOF Separate Pricing Per Customer
// if you would like to have an alert in the admin section 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 alert 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) ) {
$sql_data_array['customers_group_ra'] = '1';
}
// EOF Separate Pricing Per Customer
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') { // BOF adapted for Separate Pricing Per Customer
$sql_data_array['entry_company'] = $company;
$sql_data_array['entry_company_tax_id'] = $company_tax_id;
} // EOF adapted for Separate Pricing Per Customer
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;
}
}
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();
}
$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');
// restore cart contents
$cart->restore_contents();
// build the message content
$name = $firstname . ' ' . $lastname;
if (ACCOUNT_GENDER == 'true') {
if ($gender == 'm') {
$anrede_text = sprintf(EMAIL_GREET_MR, $lastname);
} else {
$anrede_text = sprintf(EMAIL_GREET_MS, $lastname);
}
} else {
$anrede_text = sprintf(EMAIL_GREET_NONE, $firstname);
}
$extern_email_dateipfad = DIR_WS_INCLUDES . 'languages/' . $language . '/';
$extern_email_datei = $extern_email_dateipfad . FILENAME_DEFINE_CUSTOMER_EMAIL;
$file_contents = file_get_contents($extern_email_datei);
//$email_text .= EMAIL_WELCOME . EMAIL_TEXT . EMAIL_CONTACT . EMAIL_WARNING;
// ICW - CREDIT CLASS CODE BLOCK ADDED ******************************************************* BEGIN
if (NEW_SIGNUP_GIFT_VOUCHER_AMOUNT > 0) {
$coupon_code = create_coupon_code();
$insert_query = tep_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 = tep_db_insert_id($insert_query);
$insert_query = tep_db_query("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() )");
$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 . tep_href_link(FILENAME_GV_REDEEM, 'gv_no=' . $coupon_code,'NONSSL', false) .
"\n\n";
$the_email_code = $coupon_code;
}
if (NEW_SIGNUP_DISCOUNT_COUPON != '') {
$coupon_code = NEW_SIGNUP_DISCOUNT_COUPON;
$coupon_query = tep_db_query("select * from " . TABLE_COUPONS . " where coupon_code = '" . $coupon_code . "'");
$coupon = tep_db_fetch_array($coupon_query);
$coupon_id = $coupon['coupon_id'];
$coupon_desc_query = tep_db_query("select * from " . TABLE_COUPONS_DESCRIPTION . " where coupon_id = '" . $coupon_id . "' and language_id = '" . (int)$languages_id . "'");
$coupon_desc = tep_db_fetch_array($coupon_desc_query);
$insert_query = tep_db_query("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() )");
$email_text .= EMAIL_COUPON_INCENTIVE_HEADER . "\n" .
sprintf("%s", $coupon_desc['coupon_description']) ."\n\n" .
sprintf(EMAIL_COUPON_REDEEM, $coupon['coupon_code']) . "\n\n" .
"\n\n";
}
//$email_text = $file_contents;
$phone_icon = '';
$company_logo = '';
$conditions_link = '' . CONDITIONS . '';
$account_link = '' . ACCOUNT . '';
$file_contents = preg_replace('/<-COMPANY_LOGO->/', $company_logo, $file_contents);
$file_contents = preg_replace('/<-CUSTOMER_GREETING->/', $anrede_text, $file_contents);
$file_contents = preg_replace('/<-GV_AMOUNT->/', $currencies->format(NEW_SIGNUP_GIFT_VOUCHER_AMOUNT), $file_contents);
$file_contents = preg_replace('/<-GV_CODE->/', $the_email_code, $file_contents);
$file_contents = preg_replace('/<-STORE_EMAIL->/', STORE_OWNER_EMAIL_ADDRESS, $file_contents);
$file_contents = preg_replace('/<-STORE_NAME->/', STORE_NAME, $file_contents);
$file_contents = preg_replace('/<-GV_LINK->/', tep_href_link(FILENAME_GV_REDEEM, 'gv_no=' . $the_email_code,'NONSSL', false) , $file_contents);
$file_contents = preg_replace('/<-EMAIL->/', $email_address, $file_contents);
$file_contents = preg_replace('/<-CONDITIONS_LINK->/', $conditions_link, $file_contents);
$file_contents = preg_replace('/<-INVOICE_URL->/', $account_link, $file_contents);
$file_contents = preg_replace('/<-STORE_EMAIL->/', STORE_OWNER_EMAIL_ADDRESS, $file_contents);
$file_contents = preg_replace('/<-FIRMENANSCHRIFT->/', STORE_NAME_ADDRESS, $file_contents);
$file_contents = preg_replace('/<-FINANZAMT->/', OWNER_BANK_FA, $file_contents);
$file_contents = preg_replace('/<-STEUERNUMMER->/', OWNER_BANK_TAX_NUMBER, $file_contents);
$file_contents = preg_replace('/<-USTID->/', OWNER_BANK_UST_NUMBER, $file_contents);
$file_contents = preg_replace('/<-BANKNAME->/', OWNER_BANK_NAME, $file_contents);
$file_contents = preg_replace('/<-KONTOINHABER->/', OWNER_BANK_ACCOUNT, $file_contents);
$file_contents = preg_replace('/<-BLZ->/', STORE_OWNER_BLZ, $file_contents);
$file_contents = preg_replace('/<-KONTONUMMER->/', OWNER_BANK, $file_contents);
$file_contents = preg_replace('/<-SWIFT->/', OWNER_BANK_SWIFT, $file_contents);
$file_contents = preg_replace('/<-IBAN->/', OWNER_BANK_IBAN, $file_contents);
$file_contents = preg_replace('/<-STORE_ADRESS->/', STORE_NAME_ADDRESS, $file_contents);
$file_contents = preg_replace('/<-CUSTOMER_ID->/', $customer_id, $file_contents);
$file_contents = preg_replace('/<-DATE_NOW->/', strftime(DATE_FORMAT_LONG), $file_contents);
$file_contents = preg_replace('/<-PHONE_ICON->/', $phone_icon, $file_contents);
//$email_text = $st_text;
$email_text = $file_contents;
// $email_text .= EMAIL_TEXT . EMAIL_CONTACT . EMAIL_WARNING;
// ICW - CREDIT CLASS CODE BLOCK ADDED ******************************************************* END
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
tep_redirect(tep_href_link(FILENAME_CREATE_ACCOUNT_SUCCESS, '', 'SSL'));
}
}
$breadcrumb->add(NAVBAR_TITLE, tep_href_link(FILENAME_CREATE_ACCOUNT, '', 'SSL'));
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
header("cache-Control: no-cache");
header("cache-control: no-store");
header("pragma: no-cache");
?>
>
|
|
|
size('create_account') > 0) {
?>
output('create_account'); ?> |
|
|
|
' . ENTRY_GENDER_TEXT . '': ''); ?> |
|
' . ENTRY_FIRST_NAME_TEXT . '': ''); ?> |
|
' . ENTRY_LAST_NAME_TEXT . '': ''); ?> |
|
*': ''); ?> |
|
' . ENTRY_EMAIL_ADDRESS_TEXT . '': ''); ?> |
|
' . ENTRY_EMAIL_ADDRESS_TEXT . '': ''); ?> |
|
|
|
|
|
' . ENTRY_COMPANY_TEXT . '': ''); ?> |
|
' . ENTRY_COMPANY_TAX_ID_TEXT . '': ''); ?> |
|
|
|
|
|
' . ENTRY_STREET_ADDRESS_TEXT . '': ''); ?> |
|
' . ENTRY_SUBURB_TEXT . '': ''); ?> |
|
' . ENTRY_POST_CODE_TEXT . '': ''); ?> |
|
' . ENTRY_CITY_TEXT . '': ''); ?> |
|
$zones_values['zone_name'], 'text' => $zones_values['zone_name']);
}
echo tep_draw_pull_down_menu('state', $zones_array);
} else {
echo tep_draw_input_field('state');
}
} else {
echo tep_draw_input_field('state');
}
if (tep_not_null(ENTRY_STATE_TEXT)) echo ' ' . ENTRY_STATE_TEXT;
?>
|
|
' . ENTRY_COUNTRY_TEXT . '': ''); ?> |
|
|
|
|
|
' . ENTRY_TELEPHONE_NUMBER_TEXT . '';
}else
{
$spanrequired = '';
}
?>
|
|
' . ENTRY_FAX_NUMBER_TEXT . '': ''); ?> |
|
|
|
|
|
' . ENTRY_NEWSLETTER_TEXT . '': ''); ?> |
|
|
|
|
|
|
' . ENTRY_PASSWORD_TEXT . '': ''); ?> |
|
' . ENTRY_PASSWORD_CONFIRMATION_TEXT . '': ''); ?> |
|
|
|
|
|
|
|
|
|
|