public function execute() { global $login_customer_id; $OSCOM_Db = Registry::get('Db'); if (is_int($login_customer_id) && $login_customer_id > 0) { if (SESSION_RECREATE == 'True') { tep_session_recreate(); } $Qcustomer = $OSCOM_Db->prepare('select c.customers_firstname, c.customers_default_address_id, ab.entry_country_id, ab.entry_zone_id from :table_customers c left join :table_address_book ab on (c.customers_id = ab.customers_id and c.customers_default_address_id = ab.address_book_id) where c.customers_id = :customers_id'); $Qcustomer->bindInt(':customers_id', $login_customer_id); $Qcustomer->execute(); $_SESSION['customer_id'] = $login_customer_id; $_SESSION['customer_default_address_id'] = $Qcustomer->valueInt('customers_default_address_id'); $_SESSION['customer_first_name'] = $Qcustomer->value('customers_firstname'); $_SESSION['customer_country_id'] = $Qcustomer->valueInt('entry_country_id'); $_SESSION['customer_zone_id'] = $Qcustomer->valueInt('entry_zone_id'); $Qupdate = $OSCOM_Db->prepare('update :table_customers_info set customers_info_date_of_last_logon = now(), customers_info_number_of_logons = customers_info_number_of_logons+1, password_reset_key = null, password_reset_date = null where customers_info_id = :customers_info_id'); $Qupdate->bindInt(':customers_info_id', $_SESSION['customer_id']); $Qupdate->execute(); // reset session token $_SESSION['sessiontoken'] = md5(tep_rand() . tep_rand() . tep_rand() . tep_rand()); // restore cart contents $_SESSION['cart']->restore_contents(); if (count($_SESSION['navigation']->snapshot) > 0) { $origin_href = OSCOM::link($_SESSION['navigation']->snapshot['page'], tep_array_to_string($_SESSION['navigation']->snapshot['get'], array(session_name())), $_SESSION['navigation']->snapshot['mode']); $_SESSION['navigation']->clear_snapshot(); HTTP::redirect($origin_href); } OSCOM::redirect('index.php'); } }
function tep_doautologin() { global $HTTP_COOKIE_VARS, $cart, $cart_cs, $cart_fv, $cart_pr, $customer_id, $customer_default_address_id, $customer_first_name, $customer_country_id, $customer_zone_id; global $navigation; if (isset($HTTP_COOKIE_VARS['osC_AutoCookieLogin'])) { $ip_address = tep_get_ip_address(); $check_customer_query = tep_db_query("select customers_id, customers_firstname, customers_lastname, customers_password, customers_email_address, customers_default_address_id from " . TABLE_CUSTOMERS . " where md5(CONCAT(customers_id,customers_email_address,customers_password,'" . $ip_address . "'))= '" . $HTTP_COOKIE_VARS['osC_AutoCookieLogin'] . "'"); if (tep_db_num_rows($check_customer_query)) { $check_customer = tep_db_fetch_array($check_customer_query); if (SESSION_RECREATE == 'True') { tep_session_recreate(); } $check_country_query = tep_db_query("select entry_country_id, entry_zone_id from " . TABLE_ADDRESS_BOOK . " where customers_id = '" . $check_customer['customers_id'] . "' and address_book_id = '" . (int) $check_customer['customers_default_address_id'] . "'"); $check_country = tep_db_fetch_array($check_country_query); $customer_id = $check_customer['customers_id']; $customer_default_address_id = $check_customer['customers_default_address_id']; $customer_first_name = $check_customer['customers_firstname']; $customer_country_id = $check_country['entry_country_id']; $customer_zone_id = $check_country['entry_zone_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'); } tep_autologincookie(true); // Save cookie tep_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) $customer_id . "'"); $cart->restore_contents(); // restore cart contents $cart_cs->restore_contents(); $cart_fv->restore_contents(); $cart_pr->restore_contents(); if (sizeof($navigation->snapshot) > 0) { $origin_href = tep_href_link($navigation->snapshot['page'], tep_array_to_string($navigation->snapshot['get'], array(tep_session_name())), $navigation->snapshot['mode']); $navigation->clear_snapshot(); tep_redirect($origin_href); } else { // tep_redirect(tep_href_link(FILENAME_DEFAULT)); tep_redirect(substr(tep_href_link(getenv('REQUEST_URI')), strlen(HTTP_SERVER . DIR_WS_HTTP_CATALOG))); } } } }
} 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') {
function log_customer_in($email_address = '', $password = '') { global $cart; $error = false; $check_customer_query = tep_db_query("select customers_id, abo_id, customers_firstname, customers_password, customers_email_address, customers_username, customers_default_address_id, status, customers_group from customers where customers_email_address = '" . tep_db_input($email_address) . "' OR customers_username = '******'"); if (!tep_db_num_rows($check_customer_query)) { $error = true; } else { $check_customer = tep_db_fetch_array($check_customer_query); if (!tep_validate_password($password, $check_customer['customers_password'])) { $error = true; } else { if ($check_customer['status'] == '0') { $active_error = true; } else { if (SESSION_RECREATE == 'True') { tep_session_recreate(); } $check_country_query = tep_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 = '" . (int) $check_customer['customers_default_address_id'] . "'"); $check_country = tep_db_fetch_array($check_country_query); global $customer_id, $abo_id, $customer_default_address_id, $customer_first_name, $customer_country_id, $customer_zone_id, $customer_group, $customers_email_address, $customers_username; $customer_id = $check_customer['customers_id']; $abo_id = $check_customer['abo_id']; $customer_default_address_id = $check_customer['customers_default_address_id']; $customer_first_name = $check_customer['customers_firstname']; $customer_country_id = $check_country['entry_country_id']; $customer_zone_id = $check_country['entry_zone_id']; $customer_group = $check_customer['customers_group']; $customers_email_address = $check_customer['customers_email_address']; $customers_username = $check_customer['customers_username']; tep_session_register('customer_id'); tep_session_register('abo_id'); tep_session_register('customer_default_address_id'); tep_session_register('customer_first_name'); tep_session_register('customer_country_id'); tep_session_register('customer_zone_id'); tep_session_register('customer_group'); tep_session_register('customers_email_address'); tep_session_register('customers_username'); /*autologin*/ $cookie_url_array = parse_url((ENABLE_SSL == true ? HTTPS_SERVER : HTTP_SERVER) . substr(DIR_WS_CATALOG, 0, -1)); $cookie_path = $cookie_url_array['path']; if (ALLOW_AUTOLOGON == 'false' || $_POST['remember_me'] == '') { setcookie("email_address", "", time() - 3600, $cookie_path); // Delete email_address cookie setcookie("password", "", time() - 3600, $cookie_path); // Delete password cookie } else { setcookie('email_address', $email_address, time() + 365 * 24 * 3600, $cookie_path, '', getenv('HTTPS') == 'on' ? 1 : 0); setcookie('password', $check_customer['customers_password'], time() + 365 * 24 * 3600, $cookie_path, '', getenv('HTTPS') == 'on' ? 1 : 0); } /*autologin*/ tep_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) $customer_id . "'"); $cart->restore_contents(); /*FORUM*/ if (FORUM_ACTIVE == 'true' && FORUM_CROSS_LOGIN == 'true') { $user->session_begin(); $auth->acl($user->data); $get_forum_username_query = tep_db_query("SELECT username_clean FROM " . FORUM_DB_DATABASE . ".users WHERE user_email = '" . $_POST['email_address'] . "'"); $get_forum_username = tep_db_fetch_array($get_forum_username_query); if ($_POST['remember_me'] == 'on') { $remember = 'true'; } else { $remember = 'false'; } $auth->login($get_forum_username['username_clean'], $_POST['password'], $remember, 1, 0); } /*FORUM*/ } } } if ($error == true) { return Translate('Fout: er kon niet ingelogd worden met het ingegeven e-mailadres en wachtwoord. Gelieve opnieuw te proberen'); } if ($active_error == true) { return Translate('Uw account werd nog niet geactiveerd.'); } return true; }
function processAjaxLogin($emailAddress, $password) { global $cart, $customer_id, $onepage, $customer_default_address_id, $customer_first_name, $customer_country_id, $customer_zone_id, $sendto, $billto; $error = false; $check_customer_query = tep_db_query("select customers_id, customers_firstname, customers_password, customers_email_address, customers_default_address_id from " . TABLE_CUSTOMERS . " where customers_email_address = '" . tep_db_input($emailAddress) . "'"); if (!tep_db_num_rows($check_customer_query)) { $error = true; } else { $check_customer = tep_db_fetch_array($check_customer_query); // Check that password is good if (!tep_validate_password($password, $check_customer['customers_password'])) { $error = true; } else { if (SESSION_RECREATE == 'True') { tep_session_recreate(); } $check_country_query = tep_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 = '" . (int) $check_customer['customers_default_address_id'] . "'"); $check_country = tep_db_fetch_array($check_country_query); $customer_id = $check_customer['customers_id']; $onepage['customer']['email_address'] = $check_customer['customers_email_address']; $customer_default_address_id = $check_customer['customers_default_address_id']; $customer_first_name = $check_customer['customers_firstname']; $customer_country_id = $check_country['entry_country_id']; $customer_zone_id = $check_country['entry_zone_id']; $onepage['createAccount'] = false; $sendto = $customer_default_address_id; $billto = $customer_default_address_id; $this->setDefaultSendTo(); $this->setDefaultBillTo(); 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_id')) { tep_session_register('customer_id'); } tep_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) $customer_id . "'"); // restore cart contents $cart->restore_contents(); } } $json = ''; if ($error === false) { $json .= '{ "success": "true", "msg": "Loading your account info" }'; } else { $json .= '{ "success": "false", "msg": "Authorization Failed" }'; } return $json; }
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 ') . ' ' . $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 © ' . 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 © 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 © 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 © 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); } }
function user_login($email_address) { global $order, $customer_id, $customer_default_address_id, $customer_first_name, $customer_country_id, $customer_zone_id; /* This allows the user to login with only a valid email (the email address sent back by PayPal) Their PayPal payerID is stored in the database, but I still don't know if that number changes. If it doesn't, it could be used to help identify an existing customer who hasn't logged in. Until I know for sure, the email address is enough */ global $session_started, $language, $cart; if ($session_started == false) { tep_redirect(tep_href_link(FILENAME_COOKIE_USAGE)); } require DIR_WS_LANGUAGES . $language . '/' . FILENAME_LOGIN; $check_customer_query = tep_db_query("select customers_id, customers_firstname, customers_password, customers_email_address, customers_default_address_id, customers_paypal_payerid from " . TABLE_CUSTOMERS . " where customers_email_address = '" . tep_db_input($email_address) . "'"); $check_customer = tep_db_fetch_array($check_customer_query); if (!tep_db_num_rows($check_customer_query)) { $this->away_with_you(MODULE_PAYMENT_PAYPAL_DP_TEXT_BAD_LOGIN, true); } else { if (SESSION_RECREATE == 'True') { tep_session_recreate(); } $check_country_query = tep_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 = '" . (int) $check_customer['customers_default_address_id'] . "'"); $check_country = tep_db_fetch_array($check_country_query); $customer_id = $check_customer['customers_id']; $customer_default_address_id = $check_customer['customers_default_address_id']; $customer_first_name = $check_customer['customers_firstname']; $customer_country_id = $check_country['entry_country_id']; $customer_zone_id = $check_country['entry_zone_id']; tep_session_register('customer_id'); tep_session_register('customer_default_address_id'); tep_session_register('customer_first_name'); tep_session_register('customer_country_id'); tep_session_register('customer_zone_id'); $order->customer['id'] = $customer_id; tep_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) $customer_id . "'"); $cart->restore_contents(); $this->away_with_you(); } }
function checkout_login($email_address, $password, $pass_crypt) { global $error, $cart, $wishList; global $customer_id; global $customer_default_address_id; global $customer_first_name; global $customer_password; global $customer_country_id; global $customer_zone_id; $email_address = tep_db_prepare_input($email_address); $password = tep_db_prepare_input($password); // Check if email exists $check_customer_query = tep_db_query("select customers_id, customers_firstname, customers_password, customers_email_address, customers_default_address_id from " . TABLE_CUSTOMERS . " where customers_email_address = '" . tep_db_input($email_address) . "'"); if (!tep_db_num_rows($check_customer_query)) { $error = true; } else { $check_customer = tep_db_fetch_array($check_customer_query); // Check that password is good if (isset($pass_crypt) ? $pass_crypt != $check_customer['customers_password'] : !tep_validate_password($password, $check_customer['customers_password'])) { $error = true; } else { if (SESSION_RECREATE == 'True') { tep_session_recreate(); } $check_country_query = tep_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 = '" . (int) $check_customer['customers_default_address_id'] . "'"); $check_country = tep_db_fetch_array($check_country_query); $customer_id = $check_customer['customers_id']; $customer_default_address_id = $check_customer['customers_default_address_id']; $customer_first_name = $check_customer['customers_firstname']; $customer_password = $password; $customer_country_id = $check_country['entry_country_id']; $customer_zone_id = $check_country['entry_zone_id']; tep_session_register('customer_id'); tep_session_register('customer_default_address_id'); tep_session_register('customer_first_name'); tep_session_register('customer_password'); tep_session_register('customer_country_id'); tep_session_register('customer_zone_id'); tep_session_unregister('referral_id'); //rmh referral tep_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) $customer_id . "'"); $cart->restore_contents(); $wishList->restore_wishlist(); } } }
function user_login($email_address) { global $order, $customer_id, $customer_default_address_id, $customer_first_name, $customer_country_id, $customer_zone_id; global $session_started, $language, $cart; if ($session_started == false) { tep_redirect(tep_href_link(FILENAME_COOKIE_USAGE)); } require DIR_WS_LANGUAGES . $language . '/' . FILENAME_LOGIN; $check_customer_query = tep_db_query("select customers_id, customers_firstname, customers_password, customers_email_address, customers_default_address_id, customers_paypal_payerid from " . TABLE_CUSTOMERS . " where customers_email_address = '" . tep_db_input($email_address) . "'"); $check_customer = tep_db_fetch_array($check_customer_query); if (!tep_db_num_rows($check_customer_query)) { $this->away_with_you(MODULE_PAYMENT_PAYPAL_DP_TEXT_BAD_LOGIN, true); } else { if (SESSION_RECREATE == 'True') { tep_session_recreate(); } $check_country_query = tep_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 = '" . (int) $check_customer['customers_default_address_id'] . "'"); $check_country = tep_db_fetch_array($check_country_query); $customer_id = $check_customer['customers_id']; $customer_default_address_id = $check_customer['customers_default_address_id']; $customer_first_name = $check_customer['customers_firstname']; $customer_country_id = $check_country['entry_country_id']; $customer_zone_id = $check_country['entry_zone_id']; tep_session_register('customer_id'); tep_session_register('customer_default_address_id'); tep_session_register('customer_first_name'); tep_session_register('customer_country_id'); tep_session_register('customer_zone_id'); $order->customer['id'] = $customer_id; tep_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) $customer_id . "'"); $cart->restore_contents(); $this->set_ec_order_address(); $this->away_with_you(); } }