Ejemplo n.º 1
0
     for ($i = 0, $n = sizeof($languages); $i < $n; $i++) {
         $language_id = $languages[$i]['id'];
         if ($_POST['coupon_name'][$language_id]) {
             $_POST['coupon_name'][$language_id] = trim($_POST['coupon_name'][$language_id]);
         }
         if ($_POST['coupon_desc'][$language_id]) {
             $_POST['coupon_desc'][$language_id] = trim($_POST['coupon_desc'][$language_id]);
         }
     }
     $_POST['coupon_amount'] = trim($_POST['coupon_amount']);
     $update_errors = 0;
     if (!tep_not_null($_POST['coupon_amount']) && !tep_not_null($_POST['coupon_free_ship'])) {
         $update_errors = 1;
         $messageStack->add(ERROR_NO_COUPON_AMOUNT, 'error');
     }
     $coupon_code = tep_not_null($_POST['coupon_code']) ? $_POST['coupon_code'] : create_coupon_code();
     $query1 = tep_db_query("select coupon_code from " . TABLE_COUPONS . " where coupon_code = '" . tep_db_prepare_input($coupon_code) . "'");
     if (tep_db_num_rows($query1) && $_POST['coupon_code'] && $_GET['oldaction'] != 'voucheredit') {
         $update_errors = 1;
         $messageStack->add(ERROR_COUPON_EXISTS, 'error');
     }
     if ($update_errors != 0) {
         $_GET['action'] = 'new';
     } else {
         $_GET['action'] = 'update_preview';
     }
     break;
 case 'update_confirm':
     if ($_POST['back_x'] || $_POST['back_y']) {
         if ($_GET['oldaction'] == 'voucheredit') {
             $_GET['action'] = 'voucheredit';
     }
 } else {
     // build the message content
     $name = trim($customers_firstname . BLANK . $customers_lastname);
     // load data into array
     $module_content = array();
     $module_content = array('MAIL_NAME' => $name, 'MAIL_REPLY_ADDRESS' => EMAIL_SUPPORT_REPLY_ADDRESS, 'MAIL_GENDER' => $customers_gender);
     // assign data to smarty
     $smarty->assign('content', $module_content);
     $txt_mail = CURRENT_TEMPLATE_MAIL . 'create_account_mail.';
     $html_mail = $smarty->fetch($txt_mail . 'html');
     $txt_mail = $smarty->fetch($txt_mail . 'txt');
     // GV Code Start
     // ICW - CREDIT CLASS CODE BLOCK ADDED  ******************************************************* BEGIN
     if (NEW_SIGNUP_GIFT_VOUCHER_AMOUNT > 0) {
         $coupon_code = create_coupon_code();
         $insert_query = olc_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 = olc_db_insert_id($insert_query);
         $insert_query = olc_db_query(INSERT_INTO . TABLE_COUPON_EMAIL_TRACK . " (coupon_id, customer_id_sent, sent_firstname, emailed_to, date_sent) values ('" . $insert_id . "', '0', 'Admin', '" . $customers_email_address . "', now() )");
         $html_mail .= '<br/><br/>' . sprintf(EMAIL_GV_INCENTIVE_HEADER, $currencies->format(NEW_SIGNUP_GIFT_VOUCHER_AMOUNT)) . "<br/><br/>" . sprintf(EMAIL_GV_REDEEM, $coupon_code) . "<br/><br/>" . EMAIL_GV_LINK . olc_href_link(FILENAME_GV_REDEEM, 'gv_no=' . $coupon_code, NONSSL, false) . "<br/><br/>";
         $txt_mail .= "\n\n" . 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 . olc_href_link(FILENAME_GV_REDEEM, 'gv_no=' . $coupon_code, NONSSL, false) . "\n\n";
     }
     if (NEW_SIGNUP_DISCOUNT_COUPON != '') {
         $coupon_code = NEW_SIGNUP_DISCOUNT_COUPON;
         $coupon_query = olc_db_query("select * from " . TABLE_COUPONS . " where coupon_code = '" . $coupon_code . APOS);
         $coupon = olc_db_fetch_array($coupon_query);
         $coupon_id = $coupon['coupon_id'];
         $coupon_desc_query = olc_db_query("select * from " . TABLE_COUPONS_DESCRIPTION . " where coupon_id = '" . $coupon_id . "' and language_id = '" . (int) $_SESSION['languages_id'] . APOS);
         $coupon_desc = olc_db_fetch_array($coupon_desc_query);
         $insert_query = olc_db_query(INSERT_INTO . TABLE_COUPON_EMAIL_TRACK . " (coupon_id, customer_id_sent, sent_firstname, emailed_to, date_sent) values ('" . $coupon_id . "', '0', 'Admin', '" . $customers_email_address . "', now() )");
         $html_mail .= "<br/><br/>" . EMAIL_COUPON_INCENTIVE_HEADER . HTML_BR . sprintf("%s", $coupon_desc['coupon_description']) . "<br/><br/>" . sprintf(EMAIL_COUPON_REDEEM, $coupon['coupon_code']) . "<br/><br/>" . "<br/><br/>";
Ejemplo n.º 3
0
     $message .= TEXT_OR_VISIT . HTTP_CATALOG_SERVER . DIR_WS_CATALOG . TEXT_ENTER_CODE . "\n\n";
     $html_msg['GV_CODE_URL'] .= TEXT_OR_VISIT . '<a href="' . HTTP_CATALOG_SERVER . DIR_WS_CATALOG . '">' . STORE_NAME . '</a>' . TEXT_ENTER_CODE;
     $html_msg['EMAIL_FIRST_NAME'] = $mail->fields['customers_firstname'];
     $html_msg['EMAIL_LAST_NAME'] = $mail->fields['customers_lastname'];
     // disclaimer
     $message .= "\n-----\n" . sprintf(EMAIL_DISCLAIMER, STORE_OWNER_EMAIL_ADDRESS) . "\n\n";
     zen_mail($mail->fields['customers_firstname'] . ' ' . $mail->fields['customers_lastname'], $mail->fields['customers_email_address'], $subject, $message, $from, $from, $html_msg, 'gv_mail');
     $recip_count++;
     if (SEND_EXTRA_GV_ADMIN_EMAILS_TO_STATUS == '1' and SEND_EXTRA_GV_ADMIN_EMAILS_TO != '') {
         zen_mail('', SEND_EXTRA_GV_ADMIN_EMAILS_TO, SEND_EXTRA_GV_ADMIN_EMAILS_TO_SUBJECT . ' ' . $subject, $message, $from, $from, $html_msg, 'gv_mail_extra');
     }
     // Now create the coupon main and email entry
     $mail->MoveNext();
 }
 if ($_POST['email_to']) {
     $id1 = create_coupon_code($_POST['email_to']);
     $message = zen_db_prepare_input($_POST['message']);
     $message .= "\n\n" . TEXT_GV_WORTH . $currencies->format($_POST['amount']) . "\n\n";
     $message .= TEXT_TO_REDEEM;
     $message .= TEXT_WHICH_IS . ' ' . $id1 . ' ' . TEXT_IN_CASE . "\n\n";
     $html_msg['GV_WORTH'] = TEXT_GV_WORTH;
     $html_msg['GV_AMOUNT'] = $currencies->format($_POST['amount']);
     $html_msg['GV_REDEEM'] = TEXT_TO_REDEEM . TEXT_WHICH_IS . ' <strong>' . $id1 . '</strong> ' . TEXT_IN_CASE . "\n\n";
     if (SEARCH_ENGINE_FRIENDLY_URLS == 'true') {
         $message .= HTTP_CATALOG_SERVER . DIR_WS_CATALOG . 'index.php/gv_redeem/gv_no/' . $id1 . "\n\n";
         $html_msg['GV_CODE_URL'] = '<a href="' . HTTP_CATALOG_SERVER . DIR_WS_CATALOG . 'index.php/gv_redeem/gv_no/' . $id1 . '">' . TEXT_CLICK_TO_REDEEM . '</a>' . "&nbsp;";
     } else {
         $message .= HTTP_CATALOG_SERVER . DIR_WS_CATALOG . 'index.php?main_page=gv_redeem&gv_no=' . $id1 . "\n\n";
         $html_msg['GV_CODE_URL'] = '<a href="' . HTTP_CATALOG_SERVER . DIR_WS_CATALOG . 'index.php?main_page=gv_redeem&gv_no=' . $id1 . '">' . TEXT_CLICK_TO_REDEEM . '</a>' . "&nbsp;";
     }
     $message .= TEXT_OR_VISIT . HTTP_CATALOG_SERVER . DIR_WS_CATALOG . TEXT_ENTER_CODE . "\n\n";
 function create_account()
 {
     // Stand: 16.05.2010
     global $xtPrice;
     $firstname = xtc_db_prepare_input($this->UTF8decode($_SESSION['reshash']['FIRSTNAME']));
     $lastname = xtc_db_prepare_input($this->UTF8decode($_SESSION['reshash']['LASTNAME']));
     $email_address = xtc_db_prepare_input($_SESSION['reshash']['EMAIL']);
     $company = xtc_db_prepare_input($this->UTF8decode($_SESSION['reshash']['BUSINESS']));
     $street_address = xtc_db_prepare_input($this->UTF8decode($_SESSION['reshash']['SHIPTOSTREET'] . $_SESSION['reshash']['SHIPTOSTREET_2']));
     $postcode = xtc_db_prepare_input($_SESSION['reshash']['SHIPTOZIP']);
     $city = xtc_db_prepare_input($this->UTF8decode($_SESSION['reshash']['SHIPTOCITY']));
     $state = xtc_db_prepare_input($_SESSION['reshash']['SHIPTOSTATE']);
     $telephone = xtc_db_prepare_input($_SESSION['reshash']['PHONENUM']);
     $country_query = xtc_db_query("select * from " . TABLE_COUNTRIES . " where countries_iso_code_2 = '" . xtc_db_input($_SESSION['reshash']['SHIPTOCOUNTRYCODE']) . "' ");
     $tmp_country = xtc_db_fetch_array($country_query);
     $country = xtc_db_prepare_input($tmp_country['countries_id']);
     $customers_status = DEFAULT_CUSTOMERS_STATUS_ID;
     $sql_data_array = array('customers_status' => $customers_status, 'customers_firstname' => $firstname, 'customers_lastname' => $lastname, 'customers_email_address' => $email_address, 'customers_telephone' => $telephone, 'customers_date_added' => 'now()', 'customers_last_modified' => 'now()');
     xtc_db_perform(TABLE_CUSTOMERS, $sql_data_array);
     $_SESSION['paypal_express_new_customer'] = 'true';
     $_SESSION['customer_id'] = xtc_db_insert_id();
     $user_id = xtc_db_insert_id();
     xtc_write_user_info($user_id);
     $sql_data_array = array('customers_id' => $_SESSION['customer_id'], 'entry_firstname' => $firstname, 'entry_lastname' => $lastname, 'entry_street_address' => $street_address, 'entry_postcode' => $postcode, 'entry_city' => $city, 'entry_country_id' => $country, 'entry_company' => $company, 'entry_zone_id' => '0', 'entry_state' => $state, 'address_date_added' => 'now()', 'address_last_modified' => 'now()');
     xtc_db_perform(TABLE_ADDRESS_BOOK, $sql_data_array);
     $address_id = xtc_db_insert_id();
     $_SESSION['sendto'] = $address_id;
     xtc_db_query("update " . TABLE_CUSTOMERS . " set customers_default_address_id = '" . $address_id . "' where customers_id = '" . (int) $_SESSION['customer_id'] . "'");
     xtc_db_query("insert into " . TABLE_CUSTOMERS_INFO . " (customers_info_id, customers_info_number_of_logons, customers_info_date_account_created) values ('" . (int) $_SESSION['customer_id'] . "', '0', now())");
     if (isset($_SESSION['tracking']['refID'])) {
         // Test ob die refferers_id im Kunden noch die falsche ist (sollte varchar(32) sein)
         $rows = xtc_db_query("SHOW COLUMNS FROM " . TABLE_CUSTOMERS);
         $feld_ist_original = 0;
         while ($row = xtc_db_fetch_array($rows)) {
             if ($row['Field'] == 'refferers_id') {
                 if (substr($row['Type'], 0, 3) == 'int') {
                     $feld_ist_original = 1;
                 }
             }
         }
         if ($feld_ist_original == 1) {
             $campaign_check_query_raw = "SELECT *\n                                      FROM " . TABLE_CAMPAIGNS . "\n                                      WHERE campaigns_refID = '" . $_SESSION['tracking']['refID'] . "'";
             $campaign_check_query = xtc_db_query($campaign_check_query_raw);
             if (xtc_db_num_rows($campaign_check_query) > 0) {
                 $campaign = xtc_db_fetch_array($campaign_check_query);
                 $refID = $campaign['campaigns_id'];
             } else {
                 $refID = 0;
             }
             xtc_db_query("update " . TABLE_CUSTOMERS . " set\n                        refferers_id = '" . $refID . "'\n                        where customers_id = '" . (int) $_SESSION['customer_id'] . "'");
             $leads = $campaign['campaigns_leads'] + 1;
             xtc_db_query("update " . TABLE_CAMPAIGNS . " set\n                        campaigns_leads = '" . $leads . "'\n                        where campaigns_id = '" . $refID . "'");
         } else {
             xtc_db_query("UPDATE " . TABLE_CUSTOMERS . " \n                           SET refferers_id = '" . $_SESSION['tracking']['refID'] . "'\n                         WHERE customers_id = '" . (int) $_SESSION['customer_id'] . "'");
         }
     }
     if (ACTIVATE_GIFT_SYSTEM == 'true') {
         // GV Code Start
         // ICW - CREDIT CLASS CODE BLOCK ADDED  ******************************************************* BEGIN
         if (NEW_SIGNUP_GIFT_VOUCHER_AMOUNT > 0) {
             $coupon_code = create_coupon_code();
             $insert_query = xtc_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 = xtc_db_insert_id($insert_query);
             $insert_query = xtc_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() )");
             $_SESSION['reshash']['SEND_GIFT'] = 'true';
             $_SESSION['reshash']['GIFT_AMMOUNT'] = $xtPrice->xtcFormat(NEW_SIGNUP_GIFT_VOUCHER_AMOUNT, true);
             $_SESSION['reshash']['GIFT_CODE'] = $coupon_code;
             $_SESSION['reshash']['GIFT_LINK'] = xtc_href_link(FILENAME_GV_REDEEM, 'gv_no=' . $coupon_code, 'NONSSL', false);
         }
         if (NEW_SIGNUP_DISCOUNT_COUPON != '') {
             $coupon_code = NEW_SIGNUP_DISCOUNT_COUPON;
             $coupon_query = xtc_db_query("select * from " . TABLE_COUPONS . " where coupon_code = '" . $coupon_code . "'");
             $coupon = xtc_db_fetch_array($coupon_query);
             $coupon_id = $coupon['coupon_id'];
             $coupon_desc_query = xtc_db_query("select * from " . TABLE_COUPONS_DESCRIPTION . " where coupon_id = '" . $coupon_id . "' and language_id = '" . (int) $_SESSION['language_id'] . "'");
             $coupon_desc = xtc_db_fetch_array($coupon_desc_query);
             $insert_query = xtc_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() )");
             $_SESSION['reshash']['SEND_COUPON'] = 'true';
             $_SESSION['reshash']['COUPON_DESC'] = $coupon_desc['coupon_description'];
             $_SESSION['reshash']['COUPON_CODE'] = $coupon['coupon_code'];
         }
         // ICW - CREDIT CLASS CODE BLOCK ADDED  ******************************************************* END
         // GV Code End       // create templates
     }
     $_SESSION['ACCOUNT_PASSWORD'] = '******';
     // Login Customer
     $check_customer_query = xtc_db_query("select * from " . TABLE_CUSTOMERS . " where customers_email_address = '" . xtc_db_input($email_address) . "' and account_type = '0'");
     $check_customer = xtc_db_fetch_array($check_customer_query);
     $this->login_customer($check_customer);
     if (PAYPAL_EXPRESS_ADDRESS_OVERRIDE == 'true') {
         if ($firstname . ' ' . $lastname != $this->UTF8decode($_SESSION['reshash']['SHIPTONAME'])) {
             $this->create_shipping_address();
         }
     }
 }
Ejemplo n.º 5
0
    }
    $gv_query = tep_db_query("select amount from " . TABLE_COUPON_GV_CUSTOMER . " where customer_id = '" . $customer_id . "'");
    $gv_result = tep_db_fetch_array($gv_query);
    $customer_amount = $gv_result['amount'];
    $gv_amount = trim($_POST['amount']);
    if (ereg('[^0-9/.]', $gv_amount)) {
        $error = true;
        $error_amount = ERROR_ENTRY_AMOUNT_CHECK;
    }
    if ($gv_amount > $customer_amount || $gv_amount == 0) {
        $error = true;
        $error_amount = ERROR_ENTRY_AMOUNT_CHECK;
    }
}
if ($_GET['action'] == 'process') {
    $id1 = create_coupon_code($mail['customers_email_address']);
    $gv_query = tep_db_query("select amount from " . TABLE_COUPON_GV_CUSTOMER . " where customer_id='" . $customer_id . "'");
    $gv_result = tep_db_fetch_array($gv_query);
    $new_amount = $gv_result['amount'] - $_POST['amount'];
    if ($new_amount < 0) {
        $error = true;
        $error_amount = ERROR_ENTRY_AMOUNT_CHECK;
        $_GET['action'] = 'send';
    } else {
        $gv_query = tep_db_query("update " . TABLE_COUPON_GV_CUSTOMER . " set amount = '" . $new_amount . "' where customer_id = '" . $customer_id . "'");
        $gv_query = tep_db_query("select customers_firstname, customers_lastname from " . TABLE_CUSTOMERS . " where customers_id = '" . $customer_id . "'");
        $gv_customer = tep_db_fetch_array($gv_query);
        $gv_query = tep_db_query("insert into " . TABLE_COUPONS . " (coupon_type, coupon_code, date_created, coupon_amount) values ('G', '" . $id1 . "', NOW(), '" . $_POST['amount'] . "')");
        $insert_id = tep_db_insert_id($gv_query);
        $gv_query = tep_db_query("insert into " . TABLE_COUPON_EMAIL_TRACK . " (coupon_id, customer_id_sent, sent_firstname, sent_lastname, emailed_to, date_sent) values ('" . $insert_id . "' ,'" . $customer_id . "', '" . addslashes($gv_customer['customers_firstname']) . "', '" . addslashes($gv_customer['customers_lastname']) . "', '" . $_POST['email'] . "', now())");
        $gv_email = STORE_NAME . "\n" . EMAIL_SEPARATOR . "\n" . sprintf(EMAIL_GV_TEXT_HEADER, $currencies->format($_POST['amount'])) . "\n" . EMAIL_SEPARATOR . "\n" . sprintf(EMAIL_GV_FROM, stripslashes($_POST['send_name'])) . "\n";
Ejemplo n.º 6
0
         $message .= HTTP_SERVER . DIR_WS_CATALOG . 'gv_redeem.php' . '?gv_no=' . $id1 . "\n\n";
     }
     $message .= TEXT_OR_VISIT . HTTP_SERVER . DIR_WS_CATALOG . TEXT_ENTER_CODE;
     //Let's build a message object using the email class
     $mimemessage = new email(array('X-Mailer: IntenseCart eCommerce bulk mailer'));
     // add the message to the object
     $mimemessage->add_text($message);
     $mimemessage->build_message();
     $mimemessage->send($mail['customers_firstname'] . ' ' . $mail['customers_lastname'], $mail['customers_email_address'], '', $from, $subject);
     // Now create the coupon main and email entry
     $insert_query = tep_db_query("insert into " . TABLE_COUPONS . " (coupon_code, coupon_type, coupon_amount, date_created) values ('" . $id1 . "', 'G', '" . $HTTP_POST_VARS['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', '" . $mail['customers_email_address'] . "', now() )");
 }
 if ($HTTP_POST_VARS['email_to']) {
     $id1 = create_coupon_code($HTTP_POST_VARS['email_to']);
     $message = tep_db_prepare_input($HTTP_POST_VARS['message']);
     $message .= "\n\n" . TEXT_GV_WORTH . $currencies->format($HTTP_POST_VARS['amount']) . "\n\n";
     $message .= TEXT_TO_REDEEM;
     $message .= TEXT_WHICH_IS . $id1 . TEXT_IN_CASE . "\n\n";
     $message .= HTTP_SERVER . DIR_WS_CATALOG . 'gv_redeem.php' . '?gv_no=' . $id1 . "\n\n";
     $message .= TEXT_OR_VISIT . HTTP_SERVER . DIR_WS_CATALOG . TEXT_ENTER_CODE;
     //Let's build a message object using the email class
     $mimemessage = new email(array('X-Mailer: IntenseCart eCommerce bulk mailer'));
     // add the message to the object
     $mimemessage->add_text($message);
     $mimemessage->build_message();
     $mimemessage->send('Friend', $HTTP_POST_VARS['email_to'], '', $from, $subject);
     // Now create the coupon email entry
     $insert_query = tep_db_query("insert into " . TABLE_COUPONS . " (coupon_code, coupon_type, coupon_amount, date_created) values ('" . $id1 . "', 'G', '" . $HTTP_POST_VARS['amount'] . "', now())");
     $insert_id = tep_db_insert_id($insert_query);
Ejemplo n.º 7
0
 public function create_customer($data)
 {
     global $user, $auth, $cart, $customer_id, $currencies;
     $errors = array();
     $process = true;
     $error = false;
     //Gender
     if ($this->options['customers_gender'] == 'on') {
         if (isset($data['gender'])) {
             $gender = mysql_real_escape_string($data['gender']);
         } else {
             $gender = false;
         }
     }
     //Name
     if (isset($data['firstname']) || isset($data['lastname'])) {
         $name = '';
         if ($this->options['customers_firstname'] == 'on') {
             $name .= $data['firstname'];
         }
         if ($this->options['customers_firstname'] == 'on' && $this->options['customers_lastname'] == 'on') {
             $name .= ' ';
         }
         if ($this->options['customers_lastname'] == 'on') {
             $name .= $data['lastname'];
         }
     } else {
         if ($data['name']) {
             $name = $data['name'];
         } else {
             if ($data['fullname']) {
                 $name = $data['fullname'];
             }
         }
     }
     if (strlen($name) < ENTRY_FIRST_NAME_MIN_LENGTH) {
         $error = true;
         $errors['name'] = sprintf(Translate('Uw voornaam moet minstens %s karakters bevatten'), ENTRY_FIRST_NAME_MIN_LENGTH);
     }
     //Day of birth
     if ($this->options['customers_dob'] == 'on') {
         $dob = mysql_real_escape_string($data['dob']);
     }
     //Email adress
     if ($this->options['customers_email_address'] == 'on') {
         $email_address = mysql_real_escape_string($data['email_address']);
         if (tep_validate_email($email_address) == false) {
             $error = true;
             $errors['email_address'] = Translate('Gelieve een geldig e-mailadres in te geven');
         } 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);
             if ($check_email['total'] > 0) {
                 $error = true;
                 $errors['email_address_exists'] = Translate('Het ingegeven e-mailadres bestaat al in ons systeem. Gelieve in te loggen of een account te registreren met een ander e-mailadres');
             }
         }
     }
     //Company
     if ($this->options['entry_company'] == 'on') {
         $company = mysql_real_escape_string($data['company']);
     }
     //BTW nummer
     if ($this->options['billing_tva_intracom'] == 'on') {
         $btwnr = mysql_real_escape_string($data['btwnr']);
     }
     //Forum
     if (FORUM_ACTIVE == 'true' && FORUM_SYNC_USERS == 'true') {
         if (!isset($data['forum_username'])) {
             $data['forum_username'] = $name;
         }
         $forum_username = mysql_real_escape_string($data['forum_username']);
         if (strlen($forum_username) < ENTRY_FORUM_USERNAME_MIN_LENGTH) {
             $error = true;
             $errors['forum_username'] = sprintf(Translate('Uw gebruikersnaam moet minstens %s karakters bevatten'), ENTRY_FORUM_USERNAME_MIN_LENGTH);
         }
         /*check username*/
         $check_username_query = tep_db_query("SELECT user_id FROM " . FORUM_DB_DATABASE . ".users WHERE username_clean = '" . strtolower($forum_username) . "'");
         $check_username = tep_db_fetch_array($check_username_query);
         if (tep_db_num_rows($check_username_query) > 0) {
             $error = true;
             $errors['forum_username_exists'] = Translate('Deze gebruikernaam voor het forum is reeds in gebruik.');
         }
         /*check username*/
         $check_email_query = tep_db_query("SELECT user_id FROM " . FORUM_DB_DATABASE . ".users WHERE user_email = '" . strtolower($email_address) . "'");
         $check_email = tep_db_fetch_array($check_email_query);
         if (tep_db_num_rows($check_email_query) > 0) {
             $error = true;
             $errors['email_address_exists'] = Translate('Het ingegeven e-mailadres bestaat al in ons systeem. Gelieve in te loggen of een account te registreren met een ander e-mailadres');
         }
     }
     //Street address
     if ($this->options['entry_street_address'] == 'on') {
         $street_address = mysql_real_escape_string($data['street_address']);
         if (!preg_match("/[a-zA-Z]\\s\\d/", $street_address)) {
             $error = true;
             $errors['street_address'] = Translate('Gelieve uw straat EN huisnummer in te geven.');
         }
     }
     //Suburb
     if ($this->options['entry_suburb'] == 'on') {
         $suburb = mysql_real_escape_string($data['suburb']);
     }
     //Postcode
     if ($this->options['entry_postcode'] == 'on') {
         $postcode = mysql_real_escape_string($data['postcode']);
         if (strlen($postcode) < ENTRY_POSTCODE_MIN_LENGTH) {
             $error = true;
             $errors['postcode'] = sprintf(Translate('Uw postcode moet minstens %s karakters bevatten'), ENTRY_POSTCODE_MIN_LENGTH);
         }
     }
     //City
     if ($this->options['entry_city'] == 'on') {
         $city = mysql_real_escape_string($data['city']);
         if (strlen($city) < ENTRY_CITY_MIN_LENGTH) {
             $error = true;
             $errors['city'] = sprintf(Translate('Uw woonplaats moet minstens %s karakters bevatten'), ENTRY_CITY_MIN_LENGTH);
         }
     }
     //State
     if ($this->options['entry_state'] == 'on') {
         $state = mysql_real_escape_string($data['state']);
     }
     //Zone
     if ($this->options['entry_zone'] == 'on' && isset($data['zone_id'])) {
         $zone_id = mysql_real_escape_string($data['zone_id']);
     } else {
         $zone_id = false;
     }
     //Country
     if ($this->options['entry_country'] == 'on') {
         $country = mysql_real_escape_string($data['country']);
         if (is_numeric($country) == false || $country == '0') {
             $error = true;
             $errors['country'] = Translate('Gelieve een land uit de lijst te selecteren');
         }
     }
     //Telephone
     if ($this->options['customers_telephone'] == 'on') {
         $telephone = mysql_real_escape_string($data['telephone']);
         if (strlen($telephone) < 5) {
             $error = true;
             $errors['telephone'] = Translate('Gelieve op een correcte manier uw telefoonnummer in te geven.');
         }
     }
     //Fax
     if ($this->options['customers_fax'] == 'on') {
         $fax = mysql_real_escape_string($data['fax']);
         if ($fax != '') {
             if (strlen($fax) < 5) {
                 $error = true;
                 $errors['fax'] = Translate('Gelieve op de correcte manier uw faxnummer in te geven.');
             }
         }
     }
     //Create account type
     if ($this->options['create_account_mode'] == 'Direct access' || $this->options['create_account_mode'] == 'Moderated access') {
         $password = mysql_real_escape_string($data['password']);
         $confirmation = mysql_real_escape_string($data['confirmation']);
         if (strlen($password) < ENTRY_PASSWORD_MIN_LENGTH) {
             $error = true;
             $errors['password'] = sprintf(Translate('Uw paswoord moet minstens %s karakters bevatten'), ENTRY_PASSWORD_MIN_LENGTH);
         } elseif ($password != $confirmation) {
             $error = true;
             $errors['confirmation'] = Translate('De ingevoerde wachtwoorden moeten hetzelfde zijn. Voer ze opnieuw in.');
         }
     }
     if ($this->options['conditions_create_account'] != 'Uitgeschakeld' && CONDITIONS_MUST_ACCEPT == 'true') {
         $terms = mysql_real_escape_string($data['TermsAgree']);
         if (!$terms) {
             $error = true;
             $errors['terms'] = Translate('U moet akkoord gaan met de algemene voorwaarden voor u een account kan aanmaken!');
         }
     }
     //Check if error
     if ($error) {
         return array('errors' => $errors);
     } else {
         if ($this->options['create_account_mode'] == 'Direct access' || $this->options['create_account_mode'] == 'Moderated access') {
             /********************************/
             /*	Direct Or Moderated access	*/
             /********************************/
             if ($this->options['create_account_mode'] == 'Moderated access') {
                 $status = '0';
             } else {
                 $status = '1';
             }
             //Newsletter
             $lists = PHPLIST_LISTNUMBERS;
             $lists = explode(';', $lists);
             $newsletter = false;
             foreach ($lists as $key => $list) {
                 if (isset($data['newsletters_' . $list])) {
                     put_user_in_list($list, 'subscribe', $email_address, $lastname . ' ' . $firstname);
                     $newsletter = true;
                 }
             }
             //Customers table
             $sql_data_array = array('customers_firstname' => $name, 'customers_lastname' => '', 'customers_email_address' => $email_address, 'customers_telephone' => $telephone, 'customers_fax' => $fax, 'customers_newsletter' => $newsletter, 'customers_password' => tep_encrypt_password($password), 'status' => $status);
             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('customers', $sql_data_array);
             $customer_id = tep_db_insert_id();
             //Address book table
             $sql_data_array = array('customers_id' => $customer_id, 'entry_firstname' => $name, 'entry_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;
             }
             if (ACCOUNT_COMPANY == 'true') {
                 $sql_data_array['billing_tva_intracom'] = $btwnr;
             }
             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('address_book', $sql_data_array);
             $address_id = tep_db_insert_id();
             tep_db_query("update customers set customers_default_address_id = '" . (int) $address_id . "' where customers_id = '" . (int) $customer_id . "'");
             //Customers info table
             tep_db_query("insert into customers_info (customers_info_id, customers_info_number_of_logons, customers_info_date_account_created) values ('" . (int) $customer_id . "', '0', now())");
             //Session
             if (SESSION_RECREATE == 'True') {
                 tep_session_recreate();
             }
             $customer_first_name = $name;
             $customer_default_address_id = $address_id;
             $customer_country_id = $country;
             $customer_zone_id = $zone_id;
             if ($this->options['create_account_mode'] == 'Direct access') {
                 /********************/
                 /*	Direct access	*/
                 /********************/
                 //Forum
                 if (FORUM_ACTIVE == 'true' && FORUM_SYNC_USERS == 'true' && !empty($forum_username)) {
                     /*add user*/
                     $sql_data_array = array('user_type' => '0', 'group_id' => '10', 'user_permissions' => '', 'user_ip' => $_SERVER['REMOTE_ADDR'], 'user_regdate' => time(), 'username' => $forum_username, 'username_clean' => strtolower($forum_username), 'user_password' => phpbb_hash($password), 'user_passchg' => time(), 'user_email' => strtolower($email_address), 'user_email_hash' => phpbb_email_hash(strtolower($email_address)), 'user_lastvisit' => time(), 'user_lastmark' => time(), 'user_lastpage' => FILENAME_CREATE_ACCOUNT, 'user_lang' => 'nl', 'user_timezone' => '1.00', 'user_dst' => '1', 'user_dateformat' => 'd M Y, H:i', 'user_style' => '3', 'user_form_salt' => unique_id(), 'user_new' => '1');
                     tep_db_perform(FORUM_DB_DATABASE . '.users', $sql_data_array, 'insert', false);
                     /*get user id*/
                     $get_forum_user_query = tep_db_query("SELECT user_id FROM " . FORUM_DB_DATABASE . ".users WHERE user_email = '" . $email_address . "'");
                     $get_forum_user = tep_db_fetch_array($get_forum_user_query);
                     $get_usergroup_query = tep_db_query("SELECT group_id FROM " . FORUM_DB_DATABASE . ".groups WHERE group_name = 'REGISTERED'");
                     $get_usergroup = tep_db_fetch_array($get_usergroup_query);
                     /*add user to groups*/
                     tep_db_query("INSERT INTO " . FORUM_DB_DATABASE . ".user_group (group_id, user_id, group_leader, user_pending) VALUES ('" . $get_usergroup['group_id'] . "','" . $get_forum_user['user_id'] . "','0','0')");
                     /*user is created, let's add session for autologin*/
                     if (FORUM_CROSS_LOGIN == 'true') {
                         $user->session_begin();
                         $auth->acl($user->data);
                         $auth->login(strtolower($forum_username), $password, false, 1, 0);
                     }
                 }
                 //Session
                 $_SESSION['customer_id'] = $customer_id;
                 $_SESSION['customer_first_name'] = $customer_first_name;
                 $_SESSION['customer_default_address_id'] = $customer_default_address_id;
                 $_SESSION['customer_country_id'] = $customer_country_id;
                 $_SESSION['customer_zone_id'] = $customer_zone_id;
                 // restore cart contents
                 $cart->restore_contents();
                 //HTML mail
                 $email_table = '<table cellspacing="0" cellpadding="0" border="0" width="587" bgcolor="#ffffff">';
                 $email_table .= '<tr><td style="width:5px;"></td><td>';
                 $email_table .= Translate('Beste ') . '&nbsp;' . $name . "\n\n";
                 $email_table .= "\n" . sprintf(Translate('Wij heten u welkom bij <b>%s</b>'), STORE_NAME) . "\n\n";
                 $email_table .= "\n" . Translate('U kunt nu gebruik maken van <b>verschillende services</b> die wij aanbieden. Enkele van deze services zijn:' . "\n\n" . '<li><b>Permanente Winkelwagen</b> - Elk product die u hierin plaatst zal daar blijven totdat u ze zelf verwijderd, of gaat afrekenen.' . "\n" . '<li><b>Bestel Geschiedenis</b> - Bekijk de bestellingen die u eerder heeft geplaatst.' . "\n\n");
                 //Cadeaubon voor nieuwe klanten
                 if (NEW_SIGNUP_GIFT_VOUCHER_AMOUNT > 0) {
                     $coupon_code = create_coupon_code();
                     $insert_query = tep_db_query("insert into 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 = tep_db_query("insert into coupon_email_track (coupon_id, customer_id_sent, sent_firstname, emailed_to, date_sent) values ('" . $insert_id . "', '0', 'Admin', '" . $email_address . "', now() )");
                     $email_table .= sprintf(Translate('Als deel van de verwelkoming van nieuwe klanten hebben wij u een cadeaubon verstuurd ter waarde van %s'), $currencies->format(NEW_SIGNUP_GIFT_VOUCHER_AMOUNT)) . "\n\n";
                     $email_table .= Translate('U kan de cadeaubon valideren door op deze link te klikken') . ' <a href="' . tep_href_link(FILENAME_GV_REDEEM, 'gift=' . $coupon_code, 'NONSSL', false) . '">' . tep_href_link(FILENAME_GV_REDEEM, 'gift=' . $coupon_code, 'NONSSL', false) . '</a>' . "\n\n";
                 }
                 //Coupon code voor nieuwe klanten
                 if (NEW_SIGNUP_DISCOUNT_COUPON != '') {
                     $coupon_code = NEW_SIGNUP_DISCOUNT_COUPON;
                     $coupon_query = tep_db_query("select * from 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 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 coupon_email_track (coupon_id, customer_id_sent, sent_firstname, emailed_to, date_sent) values ('" . $coupon_id . "', '0', 'Admin', '" . $email_address . "', now() )");
                     $email_table .= Translate('Proficiat, om uw eerste bezoek aan onze shop aangenamer te maken zenden wij u een kortings coupon.') . "\n";
                     $email_table .= sprintf(Translate('Om de coupon te gebruiken vult u de coupon code, %s, in tijdens de checkout.'), $coupon['coupon_code']) . "\n\n";
                 }
                 $email_table .= "\n" . Translate('Voor hulp met een van deze services kunt u een email sturen naar ' . STORE_NAME . ': ' . STORE_OWNER_EMAIL_ADDRESS . '.' . "\n\n");
                 $email_table .= '</td><td style="width: 5px;"></td></tr></table>';
                 $Varlogo = '<a href="' . HTTP_SERVER . DIR_WS_CATALOG . '"><img src="' . HTTP_SERVER . DIR_WS_CATALOG . DIR_WS_IMAGES . 'mail/logo.jpg" border="0" /></a> ';
                 $Vartable1 = '<table width="100%"  border="0" cellpadding="0" cellspacing="0" bgcolor="#ffffff">';
                 $Vartable2 = '<table width="100%" border="0" cellpadding="3" cellspacing="3" bgcolor="#EFEFEF">';
                 $Vartext1 = '<h1>' . Translate('Account aanmaken') . '</h1>';
                 $Vartext2 = $email_table;
                 //content
                 $Varcopyright = 'Copyright &copy; ' . date('Y');
                 $Varmailfooter = Translate('Dit email adres is ingegeven op onze website door u of door een van onze bezoekers. Als u zich niet ingeschreven hebt op onze website contacteer ons dan via') . ' <a href="mailto:' . STORE_OWNER_EMAIL_ADDRESS . '">' . STORE_OWNER_EMAIL_ADDRESS . '</a>';
                 require DIR_WS_MODULES . 'email/html_create_account.php';
                 $email_text = $html_email_text;
                 //Send mail
                 tep_mail($name, $email_address, sprintf(Translate('Welkom bij %s'), STORE_NAME), $email_text, STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS);
             } else {
                 /************************/
                 /*	Moderated access	*/
                 /************************/
                 //Mail to store owner
                 $email_table = '<table cellspacing="0" cellpadding="0" border="0" width="587" bgcolor="#ffffff">';
                 $email_table .= '<tr><td style="width:5px;"></td><td>';
                 $email_table .= Translate('Beste ') . ' ' . Translate('beheerder') . "\n\n";
                 $email_table .= "\n" . sprintf(Translate('Een bezoeker heeft zich geregistreerd via %s'), STORE_NAME) . "\n\n";
                 $email_table .= "\n\n" . Translate('Deze klant zal pas kunnen inloggen op het beveiligd gedeelte van de website, nadat u de account activeert door middel van onderstaande link.') . "\n\n";
                 $email_table .= "\n\n" . '<a href="' . HTTP_SERVER . DIR_WS_HTTP_CATALOG . 'scripts/user_activate.php?user='******'">' . Translate('account activeren') . "</a>" . "\n\n";
                 $email_table .= '<table cellspacing="0" cellpadding="3" border="0" width="100%">';
                 $email_table .= '<tr><td width="150">' . Translate('Naam') . ': </td><td>' . $name . '</td></tr>';
                 //Email
                 if ($this->options['customers_email_address'] == 'on') {
                     $email_table .= "<tr><td>" . Translate('E-mailadres') . ': </td><td>' . $email_address . '</td></tr>';
                 }
                 //Company
                 if ($this->options['entry_company'] == 'on') {
                     $email_table .= "<tr><td>" . Translate('Bedrijfsnaam') . ': </td><td>' . $company . '</td></tr>';
                 }
                 //BTW nummer
                 if ($this->options['billing_tva_intracom'] == 'on') {
                     $email_table .= "<tr><td>" . Translate('BTW Nummer') . ': </td><td>' . $btwnr . '</td></tr>';
                 }
                 //Street address
                 if ($this->options['entry_street_address'] == 'on') {
                     $email_table .= "<tr><td>" . Translate('Straat en huisnummer') . ': </td><td>' . $street_address . '</td></tr>';
                 }
                 //Postcode
                 if ($this->options['entry_postcode'] == 'on') {
                     $email_table .= "<tr><td>" . Translate('Postcode') . ': </td><td>' . $postcode . '</td></tr>';
                 }
                 //City
                 if ($this->options['entry_city'] == 'on') {
                     $email_table .= "<tr><td>" . Translate('Woonplaats') . ': </td><td>' . $city . '</td></tr>';
                 }
                 //Telephone
                 if ($this->options['customers_telephone'] == 'on') {
                     $email_table .= "<tr><td>" . Translate('Telefoonnummer') . ': </td><td>' . $telephone . '</td></tr>';
                 }
                 //Fax
                 if ($this->options['customers_fax'] == 'on') {
                     $email_table .= "<tr><td>" . Translate('Faxnummer') . ': </td><td>' . $fax . '</td></tr>';
                 }
                 //Country
                 if ($this->options['entry_country'] == 'on') {
                     $email_table .= "<tr><td>" . Translate('Land') . ': </td><td>' . tep_get_country_name($country) . '</td></tr>';
                 }
                 $email_table .= '</table>';
                 $email_table .= '</td><td style="width: 5px;"></td></tr></table>';
                 $Varlogo = '<a href="' . HTTP_SERVER . DIR_WS_CATALOG . '"><img src="' . HTTP_SERVER . DIR_WS_CATALOG . DIR_WS_IMAGES . 'mail/logo.jpg" border="0" /></a> ';
                 $Vartable1 = '<table width="100%"  border="0" cellpadding="0" cellspacing="0" bgcolor="#ffffff">';
                 $Vartable2 = '<table width="100%" border="0" cellpadding="3" cellspacing="3" bgcolor="#EFEFEF">';
                 $Vartext1 = '<h1>' . Translate('Account aanmaken') . '</h1>';
                 $Vartext2 = $email_table;
                 //content
                 $Varcopyright = Translate('Copyright &copy; 2010');
                 $Varmailfooter = Translate('Dit email adres is ingegeven op onze website door u of door een van onze bezoekers. Als u zich niet ingeschreven hebt op onze website contacteer ons dan via') . ' <a href="mailto:' . STORE_OWNER_EMAIL_ADDRESS . '">' . STORE_OWNER_EMAIL_ADDRESS . '</a>';
                 require DIR_WS_MODULES . 'email/html_create_account.php';
                 $email_text = $html_email_text;
                 tep_mail(STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS, Translate('Nieuwe registratie'), $email_text, $name, $email_address);
                 //Mail to customer
                 $email_table = '<table cellspacing="0" cellpadding="0" border="0" width="587" bgcolor="#ffffff">';
                 $email_table .= '<tr><td style="width:5px;"></td><td>';
                 $email_table .= Translate('Beste ') . ' ' . $name . "\n\n";
                 $email_table .= "\n\n" . Translate('Uw account voor onze website werd succesvol aangevraagd. Hieronder vind u nog eens de ingevulde gegevens. Uw gegevens zijn aan ons doorgegeven voor moderatie. Van zodra uw account geactiveerd is, ontvangt u hierover een e-mail.') . "\n\n";
                 $email_table .= '<table cellspacing="0" cellpadding="3" border="0" width="100%">';
                 $email_table .= '<tr><td width="150">' . Translate('Naam') . ': </td><td>' . $name . '</td></tr>';
                 //Email
                 if ($this->options['customers_email_address'] == 'on') {
                     $email_table .= "<tr><td>" . Translate('E-mailadres') . ': </td><td>' . $email_address . '</td></tr>';
                 }
                 //Company
                 if ($this->options['entry_company'] == 'on') {
                     $email_table .= "<tr><td>" . Translate('Bedrijfsnaam') . ': </td><td>' . $company . '</td></tr>';
                 }
                 //BTW nummer
                 if ($this->options['billing_tva_intracom'] == 'on') {
                     $email_table .= "<tr><td>" . Translate('BTW Nummer') . ': </td><td>' . $btwnr . '</td></tr>';
                 }
                 //Street address
                 if ($this->options['entry_street_address'] == 'on') {
                     $email_table .= "<tr><td>" . Translate('Straat en huisnummer') . ': </td><td>' . $street_address . '</td></tr>';
                 }
                 //Postcode
                 if ($this->options['entry_postcode'] == 'on') {
                     $email_table .= "<tr><td>" . Translate('Postcode') . ': </td><td>' . $postcode . '</td></tr>';
                 }
                 //City
                 if ($this->options['entry_city'] == 'on') {
                     $email_table .= "<tr><td>" . Translate('Woonplaats') . ': </td><td>' . $city . '</td></tr>';
                 }
                 //Telephone
                 if ($this->options['customers_telephone'] == 'on') {
                     $email_table .= "<tr><td>" . Translate('Telefoonnummer') . ': </td><td>' . $telephone . '</td></tr>';
                 }
                 //Fax
                 if ($this->options['customers_fax'] == 'on') {
                     $email_table .= "<tr><td>" . Translate('Faxnummer') . ': </td><td>' . $fax . '</td></tr>';
                 }
                 //Country
                 if ($this->options['entry_country'] == 'on') {
                     $email_table .= "<tr><td>" . Translate('Land') . ': </td><td>' . tep_get_country_name($country) . '</td></tr>';
                 }
                 $email_table .= '</table>';
                 $email_table .= '</td><td style="width: 5px;"></td></tr></table>';
                 $Varlogo = '<a href="' . HTTP_SERVER . DIR_WS_CATALOG . '"><img src="' . HTTP_SERVER . DIR_WS_CATALOG . DIR_WS_IMAGES . 'mail/logo.jpg" border="0" /></a> ';
                 $Vartable1 = '<table width="100%"  border="0" cellpadding="0" cellspacing="0" bgcolor="#ffffff">';
                 $Vartable2 = '<table width="100%" border="0" cellpadding="3" cellspacing="3" bgcolor="#EFEFEF">';
                 $Vartext1 = '<h1>' . Translate('Account aanmaken') . '</h1>';
                 $Vartext2 = $email_table;
                 //content
                 $Varcopyright = Translate('Copyright &copy; 2010');
                 $Varmailfooter = Translate('Dit email adres is ingegeven op onze website door u of door een van onze bezoekers. Als u zich niet ingeschreven hebt op onze website contacteer ons dan via') . ' <a href="mailto:' . STORE_OWNER_EMAIL_ADDRESS . '">' . STORE_OWNER_EMAIL_ADDRESS . '</a>';
                 require DIR_WS_MODULES . 'email/html_create_account.php';
                 $email_text = $html_email_text;
                 tep_mail($name, $email_address, Translate('Nieuwe registratie'), $email_text, STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS);
             }
         } else {
             /********************/
             /*	Request account	*/
             /********************/
             $email_table = '<table cellspacing="0" cellpadding="0" border="0" width="587" bgcolor="#ffffff">';
             $email_table .= '<tr><td style="width:5px;"></td><td>';
             $email_table .= Translate('Beste ') . ' ' . Translate('beheerder') . "\n\n";
             $email_table .= "\n" . sprintf(Translate('Een bezoeker heeft zich geregistreerd via %s'), STORE_NAME) . "\n\n";
             $email_table .= '<table cellspacing="0" cellpadding="3" border="0" width="100%">';
             $email_table .= '<tr><td width="150">' . Translate('Naam') . ': </td><td>' . $name . '</td></tr>';
             //Email
             if ($this->options['customers_email_address'] == 'on') {
                 $email_table .= "<tr><td>" . Translate('E-mailadres') . ': </td><td>' . $email_address . '</td></tr>';
             }
             //Company
             if ($this->options['entry_company'] == 'on') {
                 $email_table .= "<tr><td>" . Translate('Bedrijfsnaam') . ': </td><td>' . $company . '</td></tr>';
             }
             //BTW nummer
             if ($this->options['billing_tva_intracom'] == 'on') {
                 $email_table .= "<tr><td>" . Translate('BTW Nummer') . ': </td><td>' . $btwnr . '</td></tr>';
             }
             //Street address
             if ($this->options['entry_street_address'] == 'on') {
                 $email_table .= "<tr><td>" . Translate('Straat en huisnummer') . ': </td><td>' . $street_address . '</td></tr>';
             }
             //Postcode
             if ($this->options['entry_postcode'] == 'on') {
                 $email_table .= "<tr><td>" . Translate('Postcode') . ': </td><td>' . $postcode . '</td></tr>';
             }
             //City
             if ($this->options['entry_city'] == 'on') {
                 $email_table .= "<tr><td>" . Translate('Woonplaats') . ': </td><td>' . $city . '</td></tr>';
             }
             //Telephone
             if ($this->options['customers_telephone'] == 'on') {
                 $email_table .= "<tr><td>" . Translate('Telefoonnummer') . ': </td><td>' . $telephone . '</td></tr>';
             }
             //Fax
             if ($this->options['customers_fax'] == 'on') {
                 $email_table .= "<tr><td>" . Translate('Faxnummer') . ': </td><td>' . $fax . '</td></tr>';
             }
             //Country
             if ($this->options['entry_country'] == 'on') {
                 $email_table .= "<tr><td>" . Translate('Land') . ': </td><td>' . tep_get_country_name($country) . '</td></tr>';
             }
             $email_table .= '</table>';
             $email_table .= "\n\n" . Translate('Zonder manuele toevoeging in het softwarepakket, zal deze klant niet toegelaten worden in het beveiligde gedeelte van de website. ') . "\n\n";
             $email_table .= '</td><td style="width: 5px;"></td></tr></table>';
             $Varlogo = '<a href="' . HTTP_SERVER . DIR_WS_CATALOG . '"><img src="' . HTTP_SERVER . DIR_WS_CATALOG . DIR_WS_IMAGES . 'mail/logo.jpg" border="0" /></a> ';
             $Vartable1 = '<table width="100%"  border="0" cellpadding="0" cellspacing="0" bgcolor="#ffffff">';
             $Vartable2 = '<table width="100%" border="0" cellpadding="3" cellspacing="3" bgcolor="#EFEFEF">';
             $Vartext1 = '<h1>' . Translate('Account aanmaken') . '</h1>';
             $Vartext2 = $email_table;
             //content
             $Varcopyright = Translate('Copyright &copy; 2010');
             $Varmailfooter = Translate('Dit email adres is ingegeven op onze website door u of door een van onze bezoekers. Als u zich niet ingeschreven hebt op onze website contacteer ons dan via') . ' <a href="mailto:' . STORE_OWNER_EMAIL_ADDRESS . '">' . STORE_OWNER_EMAIL_ADDRESS . '</a>';
             require DIR_WS_MODULES . 'email/html_create_account.php';
             $email_text = $html_email_text;
             tep_mail(STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS, Translate('Nieuwe registratie'), $email_text, $name, $email_address);
         }
         return array('address_book_id' => $address_id, 'customer_id' => $customer_id);
     }
 }
Ejemplo n.º 8
0
 function createCustomerAccount()
 {
     global $currencies, $customer_id, $onepage, $customer_default_address_id, $customer_first_name, $customer_country_id, $customer_zone_id, $languages_id, $sendto, $billto;
     $this->checkCartValidity();
     if ($onepage['createAccount'] === true && $this->checkEmailAddress($onepage['customer']['email_address'])) {
         $sql_data_array = array('customers_firstname' => $onepage['billing']['firstname'], 'customers_lastname' => $onepage['billing']['lastname'], 'customers_email_address' => $onepage['customer']['email_address'], 'customers_telephone' => $onepage['customer']['telephone'], 'customers_fax' => $onepage['customer']['fax'], 'customers_newsletter' => $onepage['customer']['newsletter'], 'customers_password' => tep_encrypt_password($onepage['customer']['password']));
         if (ACCOUNT_GENDER == 'true') {
             $sql_data_array['customers_gender'] = $onepage['billing']['gender'];
         }
         if (ACCOUNT_DOB == 'true') {
             $sql_data_array['customers_dob'] = tep_date_raw($onepage['customer']['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' => $onepage['billing']['firstname'], 'entry_lastname' => $onepage['billing']['lastname'], 'entry_street_address' => $onepage['billing']['street_address'], 'entry_postcode' => $onepage['billing']['postcode'], 'entry_city' => $onepage['billing']['city'], 'entry_country_id' => $onepage['billing']['country_id']);
         if (ACCOUNT_GENDER == 'true') {
             $sql_data_array['entry_gender'] = $onepage['billing']['gender'];
         }
         if (ACCOUNT_COMPANY == 'true') {
             $sql_data_array['entry_company'] = $onepage['billing']['company'];
         }
         if (ACCOUNT_SUBURB == 'true') {
             $sql_data_array['entry_suburb'] = $onepage['billing']['suburb'];
         }
         if (ACCOUNT_STATE == 'true') {
             $state = $onepage['billing']['state'];
             $zone_name = '';
             $zone_id = 0;
             $check_query = tep_db_query("select count(*) as total from " . TABLE_ZONES . " where zone_country_id = '" . (int) $onepage['billing']['country_id'] . "'");
             $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, zone_name from " . TABLE_ZONES . " where zone_country_id = '" . (int) $onepage['billing']['country_id'] . "' and (zone_name = '" . tep_db_input($state) . "' or zone_code = '" . tep_db_input($state) . "')");
                 if (tep_db_num_rows($zone_query) == 1) {
                     $zone = tep_db_fetch_array($zone_query);
                     $zone_id = $zone['zone_id'];
                     $zone_name = $zone['zone_name'];
                 }
             }
             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();
         $billto = $address_id;
         $sendto = $address_id;
         $customer_default_address_id = $address_id;
         $customer_first_name = $onepage['billing']['firstname'];
         $customer_country_id = $onepage['billing']['country_id'];
         $customer_zone_id = $zone_id;
         if (isset($_POST['diffShipping'])) {
             $sql_data_array = array('customers_id' => $customer_id, 'entry_firstname' => $onepage['delivery']['firstname'], 'entry_lastname' => $onepage['delivery']['lastname'], 'entry_street_address' => $onepage['delivery']['street_address'], 'entry_postcode' => $onepage['delivery']['postcode'], 'entry_city' => $onepage['delivery']['city'], 'entry_country_id' => $onepage['delivery']['country_id']);
             if (ACCOUNT_GENDER == 'true') {
                 $sql_data_array['entry_gender'] = $onepage['delivery']['gender'];
             }
             if (ACCOUNT_COMPANY == 'true') {
                 $sql_data_array['entry_company'] = $onepage['delivery']['company'];
             }
             if (ACCOUNT_SUBURB == 'true') {
                 $sql_data_array['entry_suburb'] = $onepage['delivery']['suburb'];
             }
             if (ACCOUNT_STATE == 'true') {
                 $state = $onepage['delivery']['state'];
                 $zone_name = '';
                 $zone_id = 0;
                 $check_query = tep_db_query("select count(*) as total from " . TABLE_ZONES . " where zone_country_id = '" . (int) $onepage['delivery']['country_id'] . "'");
                 $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, zone_name from " . TABLE_ZONES . " where zone_country_id = '" . (int) $onepage['delivery']['country_id'] . "' and (zone_name = '" . tep_db_input($state) . "' or zone_code = '" . tep_db_input($state) . "')");
                     if (tep_db_num_rows($zone_query) == 1) {
                         $zone = tep_db_fetch_array($zone_query);
                         $zone_id = $zone['zone_id'];
                         $zone_name = $zone['zone_name'];
                     }
                 }
                 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);
             $sendto = 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())");
         $Qcustomer = tep_db_query('select customers_firstname, customers_lastname, customers_email_address from ' . TABLE_CUSTOMERS . ' where customers_id = "' . $customer_id . '"');
         $customer = tep_db_fetch_array($Qcustomer);
         // build the message content
         $name = $customer['customers_firstname'] . ' ' . $customer['customers_lastname'];
         if (ACCOUNT_GENDER == 'true') {
             if ($sql_data_array['entry_gender'] == '') {
                 $email_text = sprintf(EMAIL_GREET_NONE, $customer['customers_firstname'] . ' ' . $customer['customers_lastname']);
             } elseif ($sql_data_array['entry_gender'] == 'm') {
                 $email_text = sprintf(EMAIL_GREET_MR, $customer['customers_lastname']);
             } else {
                 $email_text = sprintf(EMAIL_GREET_MS, $customer['customers_lastname']);
             }
         } else {
             $email_text = sprintf(EMAIL_GREET_NONE, $customer['customers_firstname']);
         }
         $email_text .= EMAIL_WELCOME;
         $email_text .= 'You can log into your account using the following' . "\n" . 'Username: '******'customer']['email_address'] . "\n" . 'Password: '******'customer']['password'] . "\n\n";
         $email_text .= EMAIL_TEXT . EMAIL_CONTACT . EMAIL_WARNING;
         if (MODULE_ORDER_TOTAL_COUPON_STATUS == 'true') {
             // Start - CREDIT CLASS Gift Voucher Contribution
             if (NEW_SIGNUP_GIFT_VOUCHER_AMOUNT > 0) {
                 $coupon_code = create_coupon_code();
                 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();
                 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', '" . $customer['customers_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";
             }
             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);
                 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', '" . $customer['customers_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";
             }
             // End - CREDIT CLASS Gift Voucher Contribution
         }
         $onepage['createAccount'] = false;
         tep_mail($name, $customer['customers_email_address'], EMAIL_SUBJECT, $email_text, STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS);
         if (isset($onepage['info']['order_id'])) {
             tep_db_query('update ' . TABLE_ORDERS . ' set customers_id = "' . $customer_id . '" where orders_id = "' . $onepage['info']['order_id'] . '"');
             unset($onepage['info']['order_id']);
         }
         if (!tep_session_is_registered('customer_id')) {
             tep_session_register('customer_id');
         }
         if (!tep_session_is_registered('customer_default_address_id')) {
             tep_session_register('customer_default_address_id');
         }
         if (!tep_session_is_registered('customer_first_name')) {
             tep_session_register('customer_first_name');
         }
         if (!tep_session_is_registered('customer_country_id')) {
             tep_session_register('customer_country_id');
         }
         if (!tep_session_is_registered('customer_zone_id')) {
             tep_session_register('customer_zone_id');
         }
         if (!tep_session_is_registered('sendto')) {
             tep_session_register('sendto');
         }
         if (!tep_session_is_registered('billto')) {
             tep_session_register('billto');
         }
         if (!tep_session_is_registered('customer_default_address_id')) {
             tep_session_register('customer_default_address_id');
         }
         if (!tep_session_is_registered('customer_first_name')) {
             tep_session_register('customer_first_name');
         }
         if (!tep_session_is_registered('customer_country_id')) {
             tep_session_register('customer_country_id');
         }
         if (!tep_session_is_registered('customer_zone_id')) {
             tep_session_register('customer_zone_id');
         }
         if (!tep_session_is_registered('sendto')) {
             tep_session_register('sendto');
         }
         if (!tep_session_is_registered('billto')) {
             tep_session_register('billto');
         }
     } else {
         $onepage['createAccount'] = false;
         //tep_redirect(tep_href_link(FILENAME_CHECKOUT,'error='.url_encode('Your email address already exists in our records')));
     }
 }
    return $id1;
}
$prefix = 'OTTO1';
$length = 5;
$vouchers_total = 4000;
$voucher_amount = 0.2;
$voucher_free_shipping = '0';
//0=No Free Shipping, 1=Free Shipping
$voucher_type = 'C';
//F=Gift Voucher, C=Coupon Code
$voucher_start_date = '2010-08-01';
$voucher_expire_date = '2011-08-01';
$coupon_name = 'OTTO 4000 vouchers 2010';
$coupon_description = 'Auto generated 20% voucher made for otto on August 2010';
for ($x = 1; $x <= $vouchers_total; $x++) {
    $coupon_code = create_coupon_code("secret", $length, $prefix);
    $sql_data_array = array('coupon_code' => $coupon_code, 'coupon_amount' => $voucher_amount, 'free_shipping' => $voucher_free_shipping, 'coupon_minimum_order' => 0, 'coupon_start_date' => $voucher_start_date, 'coupon_expire_date' => $voucher_expire_date, 'uses_per_coupon' => 1, 'uses_per_user' => 1, 'coupon_active' => 'Y');
    $sql_data_array['coupon_type'] = $voucher_type;
    $sql_data_array['date_created'] = date('Y-m-d H:i:s');
    $sql_data_array['date_modified'] = date('Y-m-d H:i:s');
    tep_db_perform('coupons', $sql_data_array);
    $coupon_id = tep_db_insert_id();
    foreach ($languages as $lid => $l) {
        $sql_data_array = array();
        $sql_data_array['coupon_id'] = $coupon_id;
        $sql_data_array['language_id'] = $lid;
        $sql_data_array['coupon_name'] = $coupon_name;
        $sql_data_array['coupon_description'] = $coupon_description;
        tep_db_perform('coupons_description', $sql_data_array);
    }
    echo $x . ' - ';