if (SESSION_RECREATE == 'True') { xtc_session_recreate(); } $check_country_query = xtc_db_query("select entry_country_id, entry_zone_id from " . TABLE_ADDRESS_BOOK . " where customers_id = '" . (int) $check_customer['customers_id'] . "' and address_book_id = '" . $check_customer['customers_default_address_id'] . "'"); $check_country = xtc_db_fetch_array($check_country_query); $_SESSION['customer_gender'] = $check_customer['customers_gender']; $_SESSION['customer_first_name'] = $check_customer['customers_firstname']; $_SESSION['customer_last_name'] = $check_customer['customers_lastname']; $_SESSION['customer_id'] = $check_customer['customers_id']; $_SESSION['customer_vat_id'] = $check_customer['customers_vat_id']; $_SESSION['customer_default_address_id'] = $check_customer['customers_default_address_id']; $_SESSION['customer_country_id'] = $check_country['entry_country_id']; $_SESSION['customer_zone_id'] = $check_country['entry_zone_id']; $date_now = date('Ymd'); xtc_db_query("update " . TABLE_CUSTOMERS_INFO . " SET customers_info_date_of_last_logon = now(), customers_info_number_of_logons = customers_info_number_of_logons+1 WHERE customers_info_id = '" . (int) $_SESSION['customer_id'] . "'"); xtc_write_user_info((int) $_SESSION['customer_id']); // restore cart contents $_SESSION['cart']->restore_contents(); if (is_object($econda)) { $econda->_loginUser(); } if (isset($_SESSION['REFERER']) && !empty($_SESSION['REFERER'])) { xtc_redirect(xtc_href_link($_SESSION['REFERER'], xtc_get_all_get_params(array('review_prod_id')) . (isset($_GET['review_prod_id']) ? 'products_id=' . $_GET['review_prod_id'] : ''))); } elseif ($_SESSION['cart']->count_contents() > 0 && !isset($_GET['review_prod_id']) && !isset($_GET['order_id'])) { xtc_redirect(xtc_href_link(FILENAME_SHOPPING_CART), 'NONSSL'); } else { xtc_redirect(xtc_href_link(FILENAME_DEFAULT), 'NONSSL'); } } } }
function login_customer($check_customer) { // Stand: 29.04.2009 global $main, $xtPrice, $econda; if (SESSION_RECREATE == 'True') { xtc_session_recreate(); } $check_country_query = xtc_db_query("select entry_country_id, entry_zone_id from " . TABLE_ADDRESS_BOOK . " where customers_id = '" . (int) $check_customer['customers_id'] . "' and address_book_id = '" . $check_customer['customers_default_address_id'] . "'"); $check_country = xtc_db_fetch_array($check_country_query); $_SESSION['customer_gender'] = $check_customer['customers_gender']; $_SESSION['customer_first_name'] = $check_customer['customers_firstname']; $_SESSION['customer_last_name'] = $check_customer['customers_lastname']; $_SESSION['customer_id'] = $check_customer['customers_id']; $_SESSION['customer_vat_id'] = $check_customer['customers_vat_id']; $_SESSION['customer_default_address_id'] = $check_customer['customers_default_address_id']; $_SESSION['customer_country_id'] = $check_country['entry_country_id']; $_SESSION['customer_zone_id'] = $check_country['entry_zone_id']; $_SESSION['customer_email_address'] = $check_customer['customers_email_address']; $date_now = date('Ymd'); xtc_db_query("update " . TABLE_CUSTOMERS_INFO . " SET customers_info_date_of_last_logon = now(), customers_info_number_of_logons = customers_info_number_of_logons+1 WHERE customers_info_id = '" . (int) $_SESSION['customer_id'] . "'"); xtc_write_user_info((int) $_SESSION['customer_id']); // Falls vorher schon mal eingeloggt und was in der Cart war xtc_db_query("delete from " . TABLE_CUSTOMERS_BASKET . " where customers_id = '" . (int) $_SESSION['customer_id'] . "'"); xtc_db_query("delete from " . TABLE_CUSTOMERS_BASKET_ATTRIBUTES . " where customers_id = '" . (int) $_SESSION['customer_id'] . "'"); // Warenkorb restoren $_SESSION['cart']->restore_contents(); if (is_object($econda)) { $econda->_loginUser(); } // write customers status in session require DIR_WS_INCLUDES . 'write_customers_status.php'; $xtPrice = new xtcPrice($_SESSION['currency'], $_SESSION['customers_status']['customers_status_id']); }
} else { $customers_status = 2; } } if ($error == false) { $sql_data_array = array('customers_vat_id' => $vat, 'customers_vat_id_status' => $customers_vat_id_status, 'customers_status' => $customers_status, 'customers_firstname' => $firstname, 'customers_lastname' => $lastname, 'customers_email_address' => $email_address, 'customers_telephone' => $telephone, 'customers_fax' => $fax, 'customers_newsletter' => $newsletter, 'customers_password' => xtc_encrypt_password($password), 'customers_date_added' => 'now()', 'customers_last_modified' => 'now()'); if (ACCOUNT_GENDER == 'true') { $sql_data_array['customers_gender'] = $gender; } if (ACCOUNT_DOB == 'true') { $sql_data_array['customers_dob'] = xtc_date_raw($dob); } xtc_db_perform(TABLE_CUSTOMERS, $sql_data_array); $_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, 'address_date_added' => 'now()', 'address_last_modified' => 'now()'); if (ACCOUNT_GENDER == 'true') { $sql_data_array['entry_gender'] = $gender; } if (ACCOUNT_COMPANY == 'true') { $sql_data_array['entry_company'] = $company; } 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 {