$select = "\n\t\t\tSELECT\n customers_id,\n customers_firstname,\n customers_lastname,\n customers_email_address,\n customers_email_type"; $where = " WHERE customers_status='" . $groups[$i] . APOS; for ($i = 0, $n = sizeof($groups); $i < $n; $i++) { // check if cusomer want newsletter $select_all = $status_all == 'yes'; if ($select_all) { $customers_query = olc_db_query($select . " FROM " . TABLE_CUSTOMERS . $where); } else { $customers_query = olc_db_query($select . ",mail_key\n FROM " . TABLE_NEWSLETTER_RECIPIENTS . $where . " and mail_status='1'"); } $table = TABLE_MODULE_NEWSLETTER_TEMP . $id_post; $group = $groups[$i]; while ($customers_data = olc_db_fetch_array($customers_query)) { $email = $customers_data['customers_email_address']; if ($select_all) { $customers_data['mail_key'] = olc_encrypt_password($email); } $sql_data_array = array('customers_id' => $customers_data['customers_id'], 'customers_status' => $group, 'customers_firstname' => $customers_data['customers_firstname'], 'customers_lastname' => $customers_data['customers_lastname'], 'customers_email_address' => $email, 'customers_email_type' => $customers_data['customers_email_type'], 'mail_key' => $customers_data['mail_key'], 'date' => 'now()'); olc_db_perform($table, $sql_data_array); } } olc_redirect(olc_href_link(FILENAME_MODULE_NEWSLETTER)); } break; case 'delete': olc_db_query(DELETE_FROM . TABLE_MODULE_NEWSLETTER . " WHERE newsletter_id='" . $id_get . APOS); olc_redirect(olc_href_link(FILENAME_MODULE_NEWSLETTER)); break; case 'send': // max email package -> should be in admin area! olc_redirect(olc_href_link(FILENAME_MODULE_NEWSLETTER, 'send=0,' . EMAIL_NEWSLETTER_PACAKGE_SIZE . '&id=' . $id_get));
function import() { $this->time_start = time(); $lines = 1; $lines_ok = 0; // sonstige variablen $newsletter = 0; $set_suburb = ACCOUNT_SUBURB == TRUE_STRING_S; $set_state = ACCOUNT_STATE == TRUE_STRING_S; $email_adresses = array(); $error = EMPTY_STRING; define('INSERT_INTO_CUSTOMERS_INFO_SQL', INSERT_INTO . TABLE_CUSTOMERS_INFO . " (customers_info_id, customers_info_number_of_logons, customers_info_date_account_created) values ('"); define('SELECT_COUNTRY_SQL', SELECT_ALL . "`countries` WHERE `countries_iso_code_2` = '"); $check_email_sql = SELECT_COUNT . "as total from " . TABLE_CUSTOMERS . " where customers_email_address = '"; $update_table_customers = SQL_UPDATE . TABLE_CUSTOMERS . " set customers_default_address_id = '"; $fh = fopen($this->filename, "r"); if ($fh) { $zeile = fgets($fh); while (!feof($fh)) { // zeile einlesen & werte zuweisen $zeile = trim(fgets($fh)); if ($zeile) { $dataArray = explode(SEMI_COLON, $zeile); for ($j = 0, $m = sizeof($this->dataArray); $j < $m; $j++) { $data = $this->dataArray[$j]; if (substr($data, -1) == CSV_TEXTSIGN) { $dataArray[$j] = substr($data, 1, strlen($data) - 2); } } list($cid, $gruppe, $anrede, $email_address, $company, $lkz, $lastname, $city, $postcode, $password, $street_address, $fax, $telephone, $firstname, $d_company, $d_lkz, $d_lastname, $d_city, $d_postcode, $d_street_address, $d_fax, $d_telephone, $d_firstname) = $dataArray; $lines++; if (!$password) { // neues zufallspasswort erstelllen. $password = getpass(10); } // vorhandene Daten aufbereiten. $gruppe = trim($gruppe); switch ($gruppe) { case "Registriert": $customers_status = DEFAULT_CUSTOMERS_STATUS_ID_CUSTOMER; break; case "Merchant": $customers_status = DEFAULT_CUSTOMERS_STATUS_ID_DEALER; break; default: $customers_status = DEFAULT_CUSTOMERS_STATUS_ID_GUEST; } $anrede = trim($anrede); switch ($anrede) { case "Herr": $gender = "m"; break; case "Frau": $gender = "f"; break; default: $gender = "m"; } $country = set_country_info($lkz); $geburtsdatum = trim($geburtsdatum); if ($geburtsdatum != EMPTY_STRING && $geburtsdatum != ".000000000") { list($jahr, $monat, $tag) = sscanf($geburtsdatum, "%4d%2d%2d.%d"); $dob = sprintf("%02d.%02d.%4d", $tag, $monat, $jahr); } else { $dob = EMPTY_STRING; } // daten in db eintragen $vatID = new vat_validation($vat, EMPTY_STRING, EMPTY_STRING, $country); $customers_status = $vatID->vat_info['status']; $customers_vat_id_status = $vatID->vat_info['vat_id_status']; if ($vatID->vat_info['error']) { $error .= ENTRY_VAT_ERROR; } $email_address = trim($email_address); $check_email_query = olc_db_query($check_email_sql . olc_db_input($email_address) . "' and account_type = '0'"); $check_email = olc_db_fetch_array($check_email_query); $s = QUOTE . $email_address . QUOTE . ' -- '; if ($check_email['total'] > 0) { $error .= $s . ENTRY_EMAIL_ADDRESS_ERROR_EXISTS . LPAREN . EMAIL_ALREADY_USED . $email_adresses[$email_address] . RPAREN; } elseif (strlen($email_address) < ENTRY_EMAIL_ADDRESS_MIN_LENGTH) { $error .= $s . ENTRY_EMAIL_ADDRESS_ERROR; } elseif (olc_validate_email($email_address) == false) { $error .= $s . ENTRY_EMAIL_ADDRESS_CHECK_ERROR; /* $fp3 = fopen("kunden_import_mail-check-fail.csv", "a"); fputs($fp3, $zeile); fclose ($fp3); */ } if ($email_adresses[$email_address]) { $email_adresses[$email_address] .= COMMA_BLANK; } $email_adresses[$email_address] .= $lines; if ($dob != EMPTY_STRING) { $date_raw = olc_date_raw($dob); if (checkdate(substr($date_raw, 4, 2), substr($date_raw, 6, 2), substr($date_raw, 0, 4)) == false) { $error .= QUOTE . $dob . QUOTE . ' -- ' . ENTRY_DATE_OF_BIRTH_ERROR; } } if ($error) { $this->errorLog[] = sprintf(TEXT_ERROR, $error, $lines); $error = EMPTY_STRING; } else { $lines_ok++; $cid = trim($cid); $firstname = trim($firstname); $lastname = trim($lastname); $telephone = trim($telephone); $fax = trim($fax); $street_address = trim($street_address); $company = trim($company); $postcode = trim($postcode); $city = trim($city); $sql_data_array = array('customers_cid' => $cid, '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' => olc_encrypt_password($password), 'customers_gender' => $gender, 'customers_dob' => $date_raw, 'customers_date_added' => 'now()', 'customers_last_modified' => 'now()'); olc_db_perform(TABLE_CUSTOMERS, $sql_data_array); $user_id = olc_db_insert_id(); $sql_data_array = array('customers_id' => $user_id, 'entry_firstname' => $firstname, 'entry_lastname' => $lastname, 'entry_street_address' => $street_address, 'entry_postcode' => $postcode, 'entry_city' => $city, 'entry_country_id' => $country, 'entry_gender' => $gender, 'entry_company' => $company, 'address_date_added' => 'now()', 'address_last_modified' => 'now()'); olc_db_perform(TABLE_ADDRESS_BOOK, $sql_data_array); $address_id = olc_db_insert_id(); olc_db_query($update_table_customers . $address_id . "' where customers_id = '" . (int) $user_id . APOS); olc_db_query(INSERT_INTO_CUSTOMERS_INFO_SQL . (int) $user_id . "', '0', now())"); if ($d_lkz) { //Separate delivery-adress. $country = set_country_info($d_lkz); $firstname = trim($d_firstname); $lastname = trim($d_lastname); $telephone = trim($d_telephone); $fax = trim($d_fax); $street_address = trim($d_street_address); $company = trim($d_company); $postcode = trim($d_postcode); $city = trim($d_city); $sql_data_array = array('customers_id' => $user_id, 'entry_firstname' => $firstname, 'entry_lastname' => $lastname, 'entry_street_address' => $street_address, 'entry_postcode' => $postcode, 'entry_city' => $city, 'entry_country_id' => $country, 'entry_gender' => $gender, 'entry_company' => $company, 'address_date_added' => 'now()', 'address_last_modified' => 'now()'); olc_db_perform(TABLE_ADDRESS_BOOK, $sql_data_array); } // create smarty elements if ($send_mail) { $this->smarty->assign('GENDER', $gender); $this->smarty->assign('FIRSTNAME', $firstname); $this->smarty->assign('LASTNAME', $lastname); $this->smarty->assign('EMAIL', $email_address); $this->smarty->assign('PASSWORT', $password); $this->smarty->caching = false; $txt_mail_customer = $this->smarty->fetch($this->email_template); // mail versenden olc_php_mail(STORE_OWNER_EMAIL_ADDRESS, STORE_OWNER, $email_address, $firstname . BLANK . $lastname, EMPTY_STRING, STORE_OWNER_EMAIL_ADDRESS, STORE_OWNER, EMPTY_STRING, EMPTY_STRING, TEXT_MAIL_SUBJECT, EMPTY_STRING, $txt_mail_customer); } } flush(); } } fclose($fh); } else { $file_error = TEXT_FILE_ERROR_OPEN; } if ($file_error) { $this->errorLog[] = sprintf(TEXT_ERROR_FILE, $file_error); } $this->result = array(array('prod_new' => $lines_ok . " von " . ($lines - 1)), $this->errorLog, $this->calcElapsedTime($this->time_start)); return $this->result; }
$error = false; if (strlen($password_current) < ENTRY_PASSWORD_MIN_LENGTH) { $error = true; $messageStack->add('account_password', ENTRY_PASSWORD_CURRENT_ERROR); } elseif (strlen($password_new) < ENTRY_PASSWORD_MIN_LENGTH) { $error = true; $messageStack->add('account_password', ENTRY_PASSWORD_NEW_ERROR); } elseif ($password_new != $password_confirmation) { $error = true; $messageStack->add('account_password', ENTRY_PASSWORD_NEW_ERROR_NOT_MATCHING); } if ($error == false) { $check_customer_query = olc_db_query("select customers_password from " . TABLE_CUSTOMERS . " where customers_id = '" . (int) $_SESSION['customer_id'] . APOS); $check_customer = olc_db_fetch_array($check_customer_query); if (olc_validate_password($password_current, $check_customer['customers_password'])) { olc_db_query(SQL_UPDATE . TABLE_CUSTOMERS . " set customers_password = '******' where customers_id = '" . (int) $_SESSION['customer_id'] . APOS); olc_db_query(SQL_UPDATE . TABLE_CUSTOMERS_INFO . " set customers_info_date_account_last_modified = now() where customers_info_id = '" . (int) $_SESSION['customer_id'] . APOS); $messageStack->add_session('account', SUCCESS_PASSWORD_UPDATED, 'success'); olc_redirect(olc_href_link(FILENAME_ACCOUNT)); } else { $error = true; $messageStack->add('account_password', ERROR_CURRENT_PASSWORD_NOT_MATCHING); } } } $breadcrumb->add(NAVBAR_TITLE_1_ACCOUNT_PASSWORD, olc_href_link(FILENAME_ACCOUNT)); $breadcrumb->add(NAVBAR_TITLE_2_ACCOUNT_PASSWORD, olc_href_link(FILENAME_ACCOUNT_PASSWORD)); require DIR_WS_INCLUDES . 'header.php'; if ($messageStack->size('account_password') > 0) { $smarty->assign('error', $messageStack->output('account_password')); }
function ec_step2() { global $paypal_ec_token, $customer_id, $customer_first_name, $language; global $customer_default_address_id, $sendto; //Visitor just came back from PayPal and so we collect all the info returned, create an account if necessary, //then log them in, and then send them to checkout_shipping.php. What a long, strange trip it's been. $_SESSION[$his->ec_checkout_text] = true; if ($paypal_ec_token == EMPTY_STRING) { if (isset($_GET['token'])) { $paypal_ec_token = $_GET['token']; } else { $this->away_with_you(MODULE_PAYMENT_PAYPAL_DP_INVALID_RESPONSE, true); } } //Make sure the token is in the correct format if (!ereg("([C-E]{2})-([A-Z0-9]{17})", $paypal_ec_token)) { $this->away_with_you(MODULE_PAYMENT_PAYPAL_DP_INVALID_RESPONSE, true); } $caller = $this->paypal_init(); $ecdt =& Services_PayPal::getType('GetExpressCheckoutDetailsRequestType'); $ecdt->setToken($paypal_ec_token); $response = $caller->GetExpressCheckoutDetails($ecdt); $response_ack = $response->Ack; if (strlen(Services_PayPal::isError($response)) > 0 || $response_ack != 'Success' && $response_ack != 'SuccessWithWarning') { if ($this->enableDebugging) { /* olc_php_mail(STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS, $this->error_dump, "In Funktion: ec_step2()\n\n".var_dump($response), STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS); */ olc_php_mail(STORE_OWNER_EMAIL_ADDRESS, STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS, STORE_NAME, EMPTY_STRING, STORE_OWNER_EMAIL_ADDRESS, STORE_OWNER, EMPTY_STRING, EMPTY_STRING, $this->error_dump, EMPTY_STRING, str_replace(HASH, 'ec_step2', $this->in_function) . $this->prepare_var_dump($response), EMAIL_TYPE_TEXT); } $error = $this->prepare_error(MODULE_PAYMENT_PAYPAL_DP_GEN_ERROR, $response); $this->away_with_you($error, true); } else { //This is an array of all the info sent back by PayPal $details = $response->getGetExpressCheckoutDetailsResponseDetails(); $payer_info = $details->getPayerInfo(); if (MODULE_PAYMENT_PAYPAL_DP_REQ_VERIFIED == 'Yes' && strtolower($payer_info->PayerStatus) != 'verified') { $this->away_with_you(MODULE_PAYMENT_PAYPAL_DP_TEXT_UNVERIFIED, true); } $paypal_ec_payer_id = $payer_info->getPayerID(); $_SESSION[$this->paypal_ec_text . 'payer_id']; $_SESSION[$this->paypal_ec_text . 'payer_id'] = $paypal_ec_payer_id; $fullname = $payer_info->getPayerName(); $address_info = $payer_info->getAddress(); //Hoag: Begin telephone fix (1 of 3) $phone = $details->getContactPhone(); //Hoag: End telephone fix (1 of 3) //I didn't include the international variables since PayPal only supports USD at this time $paypal_ec_payer_info = array('payer_id' => $payer_info->PayerID, 'payer_email' => $payer_info->Payer, 'payer_firstname' => $fullname->FirstName, 'payer_lastname' => $fullname->LastName, 'payer_business' => $payer_info->PayerBusiness, 'payer_status' => $payer_info->PayerStatus, 'ship_owner' => $address_info->AddressOwner, 'ship_name' => $address_info->Name, 'ship_street_1' => $address_info->Street1, 'ship_street_2' => $address_info->Street2, 'ship_city' => $address_info->CityName, 'ship_state' => $address_info->StateOrProvince, 'ship_postal_code' => $address_info->PostalCode, 'ship_country' => $address_info->Country, 'ship_country_name' => $address_info->CountryName, 'ship_phone' => $address_info->Phone, 'ship_phone' => $phone, 'ship_address_status' => $address_info->AddressStatus); //$_SESSION[$this->paypal_ec_text.'payer_info'] = $paypal_ec_payer_info; $_SESSION[$this->paypal_ec_text . 'payer_info']; //Get the customer's country id. $country_query = olc_db_query("SELECT countries_id, address_format_id FROM " . TABLE_COUNTRIES . " WHERE countries_name = '" . $paypal_ec_payer_info['ship_country_name'] . "' LIMIT 1"); if (olc_db_num_rows($country_query) > 0) { $country = olc_db_fetch_array($country_query); $country_id = $country['countries_id']; $address_format_id = $country['address_format_id']; } else { $country_id = EMPTY_STRING; $address_format_id = '2'; //2 is the American format } $states_query = olc_db_query("SELECT zone_id FROM " . TABLE_ZONES . " WHERE zone_code = '" . $paypal_ec_payer_info['ship_state'] . "' AND zone_country_id = '" . $country_id . "' LIMIT 1"); if (olc_db_num_rows($states_query) > 0) { $states = olc_db_fetch_array($states_query); $state_id = $states['zone_id']; } else { $state_id = EMPTY_STRING; } $order->customer['name'] = trim($paypal_ec_payer_info['payer_firstname'] . BLANK . $paypal_ec_payer_info['payer_lastname']); $order->customer['company'] = $paypal_ec_payer_info['payer_business']; $order->customer['street_address'] = $paypal_ec_payer_info['ship_street_1']; $order->customer['suburb'] = $paypal_ec_payer_info['ship_street_2']; $order->customer['city'] = $paypal_ec_payer_info['ship_city']; $order->customer['postcode'] = $paypal_ec_payer_info['ship_postal_code']; $order->customer['state'] = $paypal_ec_payer_info['ship_state']; $order->customer['country'] = $paypal_ec_payer_info['ship_country_name']; $order->customer['format_id'] = $address_format_id; $order->customer['email_address'] = $paypal_ec_payer_info['payer_email']; //Hoag: Begin telephone fix (3 of 3) $order->customer['telephone'] = $paypal_ec_payer_info['ship_phone']; //Hoag: End telephone fix (3 of 3) //For some reason, $order->billing gets erased between here and checkout_confirmation.php $order->billing['name'] = trim($paypal_ec_payer_info['payer_firstname'] . BLANK . $paypal_ec_payer_info['payer_lastname']); $order->billing['company'] = $paypal_ec_payer_info['payer_business']; $order->billing['street_address'] = $paypal_ec_payer_info['ship_street_1']; $order->billing['suburb'] = $paypal_ec_payer_info['ship_street_2']; $order->billing['city'] = $paypal_ec_payer_info['ship_city']; $order->billing['postcode'] = $paypal_ec_payer_info['ship_postal_code']; $order->billing['state'] = $paypal_ec_payer_info['ship_state']; $order->billing['country'] = $paypal_ec_payer_info['ship_country_name']; $order->billing['format_id'] = $address_format_id; /*Disabled for now //If they selected an address on PayPal's site with a different zipcode than was previously selected //send them back to the shipping page if ($order->delivery['postcode'] == $paypal_ec_payer_info['ship_postal_code']) { $goto_shipping = false; } else { $goto_shipping = true; } */ $order->delivery['name'] = trim($paypal_ec_payer_info['payer_firstname'] . BLANK . $paypal_ec_payer_info['payer_lastname']); $order->delivery['company'] = $paypal_ec_payer_info['payer_business']; $order->delivery['street_address'] = $paypal_ec_payer_info['ship_street_1']; $order->delivery['suburb'] = $paypal_ec_payer_info['ship_street_2']; $order->delivery['city'] = $paypal_ec_payer_info['ship_city']; $order->delivery['postcode'] = $paypal_ec_payer_info['ship_postal_code']; $order->delivery['state'] = $paypal_ec_payer_info['ship_state']; $order->delivery['country'] = $paypal_ec_payer_info['ship_country_name']; $order->delivery['format_id'] = $address_format_id; if (!$_SESSION[$this->paypal_ec_text . 'temp']) { $_SESSION[$this->paypal_ec_text . 'temp']; } if ($_SESSION['customer_first_name'] && $_SESSION['customer_id']) { //They're logged in, so forward them straight to checkout_shipping.php $order->customer['id'] = $customer_id; if (!$_SESSION['sendto']) { $_SESSION['sendto'] = $customer_default_address_id; } $_SESSION[$this->paypal_ec_text . 'temp'] = false; $this->away_with_you(); /*disabled for now //0.6.2b modification. If they already have a shipping amount calculated for this zip code, send them on instead of backwards if ($goto_shipping) { $this->away_with_you(); } else { $this->away_with_you(EMPTY_STRING, false, FILENAME_CHECKOUT_CONFIRMATION); } */ } else { //They're not logged in. Create an account if necessary, and then log them in. //First, see if they're an existing customer //If Paypal didn't send an email address, something went wrong if (trim($paypal_ec_payer_info['payer_email']) == EMPTY_STRING) { $this->away_with_you(MODULE_PAYMENT_PAYPAL_DP_INVALID_RESPONSE, true); } $check_customer_query = olc_db_query("select customers_id, customers_firstname, customers_lastname,\n\t\t\t\tcustomers_paypal_payerid, customers_paypal_ec from " . TABLE_CUSTOMERS . " where customers_email_address = '" . olc_db_input($paypal_ec_payer_info['payer_email']) . APOS); $check_customer = olc_db_fetch_array($check_customer_query); if (olc_db_num_rows($check_customer_query) > 0) { $check_customer = olc_db_fetch_array($check_customer_query); $acct_exists = true; if ($check_customer['customers_paypal_ec'] == '1') { //Delete the existing temporary account $this->ec_delete_user($check_customer['customers_id']); $acct_exists = false; } } //Create an account if (!$acct_exists) { //Generate a random 8-char password $salt = "46z3haZzegmn676PA3rUw2vrkhcLEn2p1c6gf7vp2ny4u3qqfqBh5j6kDhuLmyv9xf"; srand((double) microtime() * 1000000); $password = EMPTY_STRING; for ($x = 0; $x < 7; $x++) { $num = rand() % 33; $tmp = substr($salt, $num, 1); $password = $password . $tmp; } $sql_data_array = array('customers_firstname' => $paypal_ec_payer_info['payer_firstname'], 'customers_lastname' => $paypal_ec_payer_info['payer_lastname'], 'customers_email_address' => $paypal_ec_payer_info['payer_email'], 'customers_telephone' => $paypal_ec_payer_info['ship_phone'], 'customers_fax' => EMPTY_STRING, 'customers_newsletter' => '0', 'customers_password' => olc_encrypt_password($password), 'customers_paypal_payerid' => $paypal_ec_payer_id); olc_db_perform(TABLE_CUSTOMERS, $sql_data_array); $customer_id = olc_db_insert_id(); $sql_data_array = array('customers_id' => $customer_id, 'entry_firstname' => $paypal_ec_payer_info['payer_firstname'], 'entry_lastname' => $paypal_ec_payer_info['payer_lastname'], 'entry_street_address' => $paypal_ec_payer_info['ship_street_1'], 'entry_suburb' => $paypal_ec_payer_info['ship_street_2'], 'entry_city' => $paypal_ec_payer_info['ship_city'], 'entry_zone_id' => $state_id, 'entry_postcode' => $paypal_ec_payer_info['ship_postal_code'], 'entry_country_id' => $country_id); olc_db_perform(TABLE_ADDRESS_BOOK, $sql_data_array); $address_id = olc_db_insert_id(); olc_db_query(SQL_UPDATE . TABLE_CUSTOMERS . " set customers_default_address_id = '" . (int) $address_id . "' where customers_id = '" . (int) $customer_id . APOS); olc_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 (MODULE_PAYMENT_PAYPAL_DP_NEW_ACCT_NOTIFY == 'Yes') { require DIR_WS_LANGUAGES . SESSION_LANGUAGE . SLASH . FILENAME_CREATE_ACCOUNT; $email_text = sprintf(EMAIL_GREET_NONE, $paypal_ec_payer_info['payer_firstname']) . EMAIL_WELCOME . EMAIL_TEXT; $email_text .= EMAIL_EC_ACCOUNT_INFORMATION . "Username: "******"\nPassword: "******"\n\n"; $email_text .= EMAIL_CONTACT; /* olc_php_mail($paypal_ec_payer_info['payer_firstname']." " . $paypal_ec_payer_info['payer_lastname'], $paypal_ec_payer_info['payer_email'], EMAIL_SUBJECT, $email_text, STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS); */ olc_php_mail(STORE_OWNER_EMAIL_ADDRESS, STORE_OWNER, $paypal_ec_payer_info['payer_email'], trim($paypal_ec_payer_info['payer_firstname'] . BLANK . $paypal_ec_payer_info['payer_lastname']), EMPTY_STRING, STORE_OWNER_EMAIL_ADDRESS, STORE_OWNER, EMPTY_STRING, EMPTY_STRING, EMAIL_SUBJECT, EMPTY_STRING, $email_text, EMAIL_TYPE_TEXT); $_SESSION[$this->paypal_ec_text . 'temp'] = false; } else { //Make it a temporary account that'll be deleted once they've checked out olc_db_query(SQL_UPDATE . TABLE_CUSTOMERS . " SET customers_paypal_ec = '1' WHERE customers_id = '" . (int) $customer_id . APOS); $_SESSION[$this->paypal_ec_text . 'temp'] = true; } } else { $_SESSION[$this->paypal_ec_text . 'temp'] = false; } $sendto = $address_id; if (!$_SESSION['sendto']) { $_SESSION['sendto']; } $this->user_login($_SESSION[$this->paypal_ec_text . 'payer_info']['payer_email']); } } }
function addNewUser($buyer_values, &$customer_id) { $names = explode(BLANK, $buyer_values['buyer_name']); $lastname = EMPTY_STRING; for ($i = 1, $n = count($names); $i <= $n; $i++) { $lastname .= $names[$i]; if ($i < $n) { $lastname .= BLANK; } } $sql_data_array = array('customers_firstname' => $names[0], 'customers_lastname' => $lastname, 'customers_email_address' => $buyer_values['buyer_email'], 'customers_telephone' => EMPTY_STRING, 'customers_fax' => EMPTY_STRING, 'customers_newsletter' => EMPTY_STRING, 'customers_password' => olc_encrypt_password($buyer_values['buyer_id']), 'customers_gender' => EMPTY_STRING, 'customers_dob' => date("Y-m-d")); olc_db_perform(TABLE_CUSTOMERS, $sql_data_array); $customer_id = olc_db_insert_id(); $buyer_countrycode = $buyer_values['buyer_countrycode']; if ($buyer_countrycode) { $sqlstring = SELECT_ALL . TABLE_COUNTRIES . " WHERE `countries_iso_code_2` = '" . $buyer_countrycode . APOS; $mycountry = olc_db_fetch_array(olc_db_query($sqlstring)); //echo $mycountry['countries_id']."<hr/>"; } $sql_data_array = array('customers_id' => $customer_id, 'entry_firstname' => $names[0], 'entry_lastname' => $lastname, 'entry_street_address' => $buyer_values['buyer_street'], 'entry_postcode' => $buyer_values['buyer_zip'], 'entry_city' => $buyer_values['buyer_city'], 'entry_country_id' => $mycountry['countries_id'], 'entry_gender' => EMPTY_STRING, 'entry_company' => EMPTY_STRING, 'entry_suburb' => EMPTY_STRING, 'entry_zone_id' => EMPTY_STRING, 'entry_state' => $buyer_values['buyer_land']); olc_db_perform(TABLE_ADDRESS_BOOK, $sql_data_array); $address_id = olc_db_insert_id(); //update customer table with address id olc_db_query(SQL_UPDATE . TABLE_CUSTOMERS . " set customers_default_address_id = '" . $address_id . "'\n\twhere customers_id = '" . $customer_id . APOS); //update customer_info table olc_db_query(INSERT_INTO . TABLE_CUSTOMERS_INFO . "\n\t(customers_info_id, customers_info_number_of_logons, customers_info_date_account_created) values\n\t('" . $customer_id . "', '0', now())"); $_SESSION['customer_default_address_id'] = $address_id; }
/* $fp3 = fopen("kunden_import_mail-check-fail.csv", "a"); fputs($fp3, $zeile); fclose ($fp3); */ } if ($dob != '') { if (checkdate(substr(olc_date_raw($dob), 4, 2), substr(olc_date_raw($dob), 6, 2), substr(olc_date_raw($dob), 0, 4)) == false) { $error = true; echo " <b>ERROR:</b> ENTRY_DATE_OF_BIRTH_ERROR<br>\n"; //$messageStack->add('create_account', ENTRY_DATE_OF_BIRTH_ERROR); } } if ($error != true) { $lines_ok += 1; $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' => olc_encrypt_password($password), 'customers_date_added' => 'now()', 'customers_last_modified' => 'now()'); $sql_data_array['customers_gender'] = $gender; $sql_data_array['customers_dob'] = olc_date_raw($dob); olc_db_perform(TABLE_CUSTOMERS, $sql_data_array); $user_id = olc_db_insert_id(); //olc_write_user_info($user_id); $sql_data_array = array('customers_id' => $user_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()'); $sql_data_array['entry_gender'] = $gender; $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'] = '';
function olc_array_merge($array1, $array2, $array3 = '') { if ($array3 == '') { $array3 = array(); } if (function_exists('array_merge')) { $array_merged = array_merge($array1, $array2, $array3); } else { while (list($key, $val) = each($array1)) { $array_merged[$key] = $val; } while (list($key, $val) = each($array2)) { $array_merged[$key] = $val; } if (sizeof($array3) > 0) { while (list($key, $val) = each($array3)) { $array_merged[$key] = $val; } } } return (array) $array_merged; } $cn_query = olc_db_query("select * from " . TABLE_CUSTOMERS . " where customers_newsletter= '1' "); while ($cn = olc_db_fetch_array($cn_query)) { $key = olc_encrypt_password($cn['customers_email_address']); $sql_data_array = array('customers_email_address' => olc_db_prepare_input($cn['customers_email_address']), 'customers_id' => olc_db_prepare_input($cn['customers_id']), 'customers_status' => olc_db_prepare_input($cn['customers_status']), 'customers_firstname' => olc_db_prepare_input($cn['customers_firstname']), 'customers_lastname' => olc_db_prepare_input($cn['customers_lastname']), 'mail_status' => '1', 'mail_key' => $key); $insert_sql_data = array('date_added' => 'now()'); $sql_data_array = olc_array_merge($sql_data_array, $insert_sql_data); olc_db_perform(TABLE_NEWSLETTER_RECIPIENTS, $sql_data_array); } echo 'DONE';
Released under the GNU General Public License ---------------------------------------------------------------------------*/ require 'includes/application_top.php'; // include needed functions require_once DIR_FS_INC . 'olc_image_button.inc.php'; require_once DIR_FS_INC . 'olc_draw_input_field.inc.php'; // include the mailer-class require_once DIR_WS_CLASSES . 'class.phpmailer.php'; if (isset($_GET['action']) && $_GET['action'] == 'process') { $check_affiliate_query = olc_db_query("select affiliate_firstname, affiliate_lastname, affiliate_password, affiliate_id from " . TABLE_AFFILIATE . " where affiliate_email_address = '" . $_POST['email_address'] . APOS); if (olc_db_num_rows($check_affiliate_query)) { $check_affiliate = olc_db_fetch_array($check_affiliate_query); // Crypted password mods - create a new password, update the database and mail it to them $newpass = olc_create_random_value(ENTRY_PASSWORD_MIN_LENGTH); $crypted_password = olc_encrypt_password($newpass); olc_db_query(SQL_UPDATE . TABLE_AFFILIATE . " set affiliate_password = '******' where affiliate_id = '" . $check_affiliate['affiliate_id'] . APOS); olc_php_mail(AFFILIATE_EMAIL_ADDRESS, STORE_OWNER, $_POST['email_address'], $check_affiliate['affiliate_firstname'] . BLANK . $check_affiliate['affiliate_lastname'], '', AFFILIATE_EMAIL_ADDRESS, STORE_OWNER, '', '', EMAIL_PASSWORD_REMINDER_SUBJECT, nl2br(sprintf(EMAIL_PASSWORD_REMINDER_BODY, $newpass)), nl2br(sprintf(EMAIL_PASSWORD_REMINDER_BODY, $newpass))); if (!isset($mail_error)) { olc_redirect(olc_href_link(FILENAME_AFFILIATE, 'info_message=' . urlencode(TEXT_PASSWORD_SENT), SSL, true, false)); } else { echo $mail_error; } } else { olc_redirect(olc_href_link(FILENAME_AFFILIATE_PASSWORD_FORGOTTEN, 'email=nonexistent', SSL)); } } else { $breadcrumb->add(NAVBAR_TITLE, olc_href_link(FILENAME_AFFILIATE, '', SSL)); $breadcrumb->add(NAVBAR_TITLE_PASSWORD_FORGOTTEN, olc_href_link(FILENAME_AFFILIATE_PASSWORD_FORGOTTEN, '', SSL)); require DIR_WS_INCLUDES . 'header.php'; $smarty->assign('FORM_ACTION', olc_draw_form('password_forgotten', olc_href_link(FILENAME_AFFILIATE_PASSWORD_FORGOTTEN, 'action=process', SSL)));
function CustomersUpdate() { global $_POST, $Lang_folder; $customers_id = -1; // include PW function require_once DIR_FS_INC . 'olc_encrypt_password.inc.php'; if (isset($_POST['cID'])) { $customers_id = olc_db_prepare_input($_POST['cID']); } // security check, if user = admin, dont allow to perform changes if ($customers_id != -1) { $sec_query = olc_db_query("SELECT customers_status FROM " . TABLE_CUSTOMERS . " where customers_id='" . $customers_id . "'"); $sec_data = olc_db_fetch_array($sec_query); if ($sec_data['customers_status'] == 0) { print_xml_status(120, $_POST['action'], 'CAN NOT CHANGE ADMIN USER!', '', '', ''); return; } } $sql_customers_data_array = array(); if (isset($_POST['customers_cid'])) { $sql_customers_data_array['customers_cid'] = $_POST['customers_cid']; } if (isset($_POST['customers_firstname'])) { $sql_customers_data_array['customers_firstname'] = $_POST['customers_firstname']; } if (isset($_POST['customers_lastname'])) { $sql_customers_data_array['customers_lastname'] = $_POST['customers_lastname']; } if (isset($_POST['customers_dob'])) { $sql_customers_data_array['customers_dob'] = $_POST['customers_dob']; } if (isset($_POST['customers_email'])) { $sql_customers_data_array['customers_email_address'] = $_POST['customers_email']; } if (isset($_POST['customers_tele'])) { $sql_customers_data_array['customers_telephone'] = $_POST['customers_tele']; } if (isset($_POST['customers_fax'])) { $sql_customers_data_array['customers_fax'] = $_POST['customers_fax']; } if (isset($_POST['customers_gender'])) { $sql_customers_data_array['customers_gender'] = $_POST['customers_gender']; } if (isset($_POST['customers_password'])) { $sql_customers_data_array['customers_password'] = olc_encrypt_password($_POST['customers_password']); } $sql_address_data_array = array(); if (isset($_POST['customers_firstname'])) { $sql_address_data_array['entry_firstname'] = $_POST['customers_firstname']; } if (isset($_POST['customers_lastname'])) { $sql_address_data_array['entry_lastname'] = $_POST['customers_lastname']; } if (isset($_POST['customers_company'])) { $sql_address_data_array['entry_company'] = $_POST['customers_company']; } if (isset($_POST['customers_street'])) { $sql_address_data_array['entry_street_address'] = $_POST['customers_street']; } if (isset($_POST['customers_city'])) { $sql_address_data_array['entry_city'] = $_POST['customers_city']; } if (isset($_POST['customers_postcode'])) { $sql_address_data_array['entry_postcode'] = $_POST['customers_postcode']; } if (isset($_POST['customers_gender'])) { $sql_address_data_array['entry_gender'] = $_POST['customers_gender']; } if (isset($_POST['customers_country_id'])) { $country_code = $_POST['customers_country_id']; } $country_query = "SELECT countries_id FROM " . TABLE_COUNTRIES . " WHERE countries_iso_code_2 = '" . $country_code . "' LIMIT 1"; $country_result = olc_db_query($country_query); $row = olc_db_fetch_array($country_result); $sql_address_data_array['entry_country_id'] = $row['countries_id']; $count_query = olc_db_query("SELECT count(*) as count FROM " . TABLE_CUSTOMERS . " WHERE customers_id='" . (int) $customers_id . "' LIMIT 1"); $check = olc_db_fetch_array($count_query); if ($check['count'] > 0) { $mode = 'SQL_UPDATE'; $address_book_result = olc_db_query("SELECT customers_default_address_id FROM " . TABLE_CUSTOMERS . " WHERE customers_id = '" . (int) $customers_id . "' LIMIT 1"); $customer = olc_db_fetch_array($address_book_result); olc_db_perform(TABLE_CUSTOMERS, $sql_customers_data_array, 'update', "customers_id = '" . olc_db_input($customers_id) . "' LIMIT 1"); olc_db_perform(TABLE_ADDRESS_BOOK, $sql_address_data_array, 'update', "customers_id = '" . olc_db_input($customers_id) . "' AND address_book_id = '" . $customer['customers_default_address_id'] . "' LIMIT 1"); olc_db_query("update " . TABLE_CUSTOMERS_INFO . " set customers_info_date_account_last_modified = now() where customers_info_id = '" . (int) $customers_id . "' LIMIT 1"); } else { $mode = 'APPEND'; if (strlen($_POST['customers_password']) == 0) { // generate PW if empty $pw = olc_RandomString(8); $sql_customers_data_array['customers_password'] = olc_create_password($pw); } olc_db_perform(TABLE_CUSTOMERS, $sql_customers_data_array); $customers_id = olc_db_insert_id(); $sql_address_data_array['customers_id'] = $customers_id; olc_db_perform(TABLE_ADDRESS_BOOK, $sql_address_data_array); $address_id = olc_db_insert_id(); olc_db_query("update " . TABLE_CUSTOMERS . " set customers_default_address_id = '" . (int) $address_id . "' where customers_id = '" . (int) $customers_id . "'"); olc_db_query("update " . TABLE_CUSTOMERS . " set customers_status = '" . STANDARD_GROUP . "' where customers_id = '" . (int) $customers_id . "'"); olc_db_query("insert into " . TABLE_CUSTOMERS_INFO . " (customers_info_id, customers_info_number_of_logons, customers_info_date_account_created) values ('" . (int) $customers_id . "', '0', now())"); } if (SEND_ACCOUNT_MAIL == true && $mode == 'APPEND' && $sql_customers_data_array['customers_email_address'] != '') { // generate mail for customer if customer=new require_once DIR_WS_CLASSES . 'class.phpmailer.php'; require_once DIR_FS_INC . 'olc_php_mail.inc.php'; require_once DIR_FS_INC . 'olc_add_tax.inc.php'; require_once DIR_FS_INC . 'olc_not_null.inc.php'; require_once DIR_FS_INC . 'changedataout.inc.php'; require_once DIR_FS_INC . 'olc_href_link.inc.php'; require_once DIR_FS_INC . 'olc_date_long.inc.php'; require_once DIR_FS_INC . 'olc_check_agent.inc.php'; $smarty = new Smarty(); //$smarty->assign('language', $check_status['language']); $smarty->assign('language', $Lang_folder); $smarty->caching = false; $smarty->template_dir = DIR_FS_CATALOG . 'templates'; $smarty->compile_dir = DIR_FS_CATALOG . 'cache/templates_c'; $smarty->config_dir = DIR_FS_CATALOG . 'lang'; $smarty->assign('tpl_path', 'templates/' . CURRENT_TEMPLATE . '/'); $smarty->assign('logo_path', HTTP_SERVER . DIR_WS_CATALOG . 'templates/' . CURRENT_TEMPLATE . '/images/'); $smarty->assign('NAME', $sql_customers_data_array['customers_lastname'] . ' ' . $sql_customers_data_array['customers_firstname']); $smarty->assign('EMAIL', $sql_customers_data_array['customers_email_address']); $smarty->assign('PASSWORD', $pw); //$smarty->assign('language', $Lang_folder); $smarty->assign('content', $module_content); $smarty->caching = false; $html_mail = $smarty->fetch(CURRENT_TEMPLATE . '/admin/mail/' . $Lang_folder . '/create_account_mail.html'); $txt_mail = $smarty->fetch(CURRENT_TEMPLATE . '/admin/mail/' . $Lang_folder . '/create_account_mail.txt'); // send mail with html/txt template olc_php_mail(EMAIL_SUPPORT_ADDRESS, EMAIL_SUPPORT_NAME, $sql_customers_data_array['customers_email_address'], $sql_customers_data_array['customers_lastname'] . ' ' . $sql_customers_data_array['customers_firstname'], '', EMAIL_SUPPORT_REPLY_ADDRESS, EMAIL_SUPPORT_REPLY_ADDRESS_NAME, '', '', EMAIL_SUPPORT_SUBJECT, $html_mail, $txt_mail); } print_xml_status(0, $_POST['action'], 'OK', $mode, 'CUSTOMERS_ID', $customers_id); }
$error = true; $entry_agb_error = true; } // Check Company $entry_company_error = false; $entry_company_taxid_error = false; // Check Payment $entry_payment_check_error = false; $entry_payment_paypal_error = false; $entry_payment_bank_name_error = false; $entry_payment_bank_branch_number_error = false; $entry_payment_bank_swift_code_error = false; $entry_payment_bank_account_name_error = false; $entry_payment_bank_account_number_error = false; if (!$error) { $sql_data_array = array('affiliate_firstname' => $a_firstname, 'affiliate_lastname' => $a_lastname, 'affiliate_email_address' => $a_email_address, 'affiliate_payment_check' => $a_payment_check, 'affiliate_payment_paypal' => $a_payment_paypal, 'affiliate_payment_bank_name' => $a_payment_bank_name, 'affiliate_payment_bank_branch_number' => $a_payment_bank_branch_number, 'affiliate_payment_bank_swift_code' => $a_payment_bank_swift_code, 'affiliate_payment_bank_account_name' => $a_payment_bank_account_name, 'affiliate_payment_bank_account_number' => $a_payment_bank_account_number, 'affiliate_street_address' => $a_street_address, 'affiliate_postcode' => $a_postcode, 'affiliate_city' => $a_city, 'affiliate_country_id' => $a_country, 'affiliate_telephone' => $a_telephone, 'affiliate_fax' => $a_fax, 'affiliate_homepage' => $a_homepage, 'affiliate_password' => olc_encrypt_password($a_password), 'affiliate_agb' => $a_agb); if (ACCOUNT_GENDER == TRUE_STRING_S) { $sql_data_array['affiliate_gender'] = $a_gender; } if (ACCOUNT_DOB == TRUE_STRING_S) { $sql_data_array['affiliate_dob'] = olc_date_raw($a_dob); } if (ACCOUNT_COMPANY == TRUE_STRING_S) { $sql_data_array['affiliate_company'] = $a_company; $sql_data_array['affiliate_company_taxid'] = $a_company_taxid; } if (ACCOUNT_SUBURB == TRUE_STRING_S) { $sql_data_array['affiliate_suburb'] = $a_suburb; } if (ACCOUNT_STATE == TRUE_STRING_S) { if ($a_zone_id > 0) {
$send_email = true; $action = 'activate'; } } else { $remove = $check == 'del'; if ($remove) { if ($have_entry) { $send_email = !$force; $action = 'remove'; } else { $info_message = TEXT_EMAIL_NOT_EXIST; } } } if ($send_email) { $link_code = olc_encrypt_password($email); $server_link = HTTP_SERVER . DIR_WS_CATALOG; $link = olc_href_link(FILENAME_NEWSLETTER, 'action=activate&email=' . $email . '&key=' . $link_code, NONSSL); if (strpos($link, server_link) === false) { $link = $server_link . $link; } // assign vars $smarty->assign('EMAIL', $email); $smarty->assign('LINK', $link); $smarty->assign('NAME', trim($customers_firstname . BLANK . $customers_lastname)); $txt_mail = CURRENT_TEMPLATE_MAIL . 'newsletter_' . $action . '_mail'; $html_mail = $smarty->fetch($txt_mail . HTML_EXT); $txt_mail = $smarty->fetch($txt_mail . '.txt'); olc_php_mail(EMAIL_SUPPORT_ADDRESS, EMAIL_SUPPORT_NAME, $email, EMPTY_STRING, EMPTY_STRING, EMAIL_SUPPORT_REPLY_ADDRESS, EMAIL_SUPPORT_REPLY_ADDRESS_NAME, EMPTY_STRING, EMPTY_STRING, TEXT_EMAIL_SUBJECT, $html_mail, $txt_mail, $customers_email_type); } } else {
if ($IsCreateAccount) { $_SESSION['account_type'] = $customers_status_c; $sql_data_array['account_type'] = $customers_status_c; if ($IsUserMode) { $sql_data_array['customers_newsletter'] = $customers_newsletter; } $sql_data_array['customers_password'] = olc_encrypt_password($customers_password); // Automatisch fortlaufende Kundennummer erzeugen: $start_cid = 21724; //Gewünschte Start-Nummer $result = olc_db_fetch_array(olc_db_query("select max(customers_cid) as cidmax from " . TABLE_CUSTOMERS)); $customers_cid = $result['cidmax'] ? $result['cidmax'] + 1 : $start_cid; $sql_data_array['customers_cid'] = $customers_cid; // End Kundennummer Mod $sql_data_array['customers_status'] = $customers_status_c; $sql_data_array['customers_password'] = olc_encrypt_password($customers_password); $action = 'insert'; $parameters = EMPTY_STRING; } else { if ($not_IsEditAccount) { $sql_data_array['customers_newsletter'] = $customers_newsletter; } $action = 'update'; $parameters = "customers_id = '" . $customers_id . APOS; } olc_db_perform(TABLE_CUSTOMERS, $sql_data_array, $action, $parameters); //if ($IsCreateUsermodeAccount) if ($IsCreateAccount) { $_SESSION['customer_id'] = olc_db_insert_id(); } $sql_data_array = array('entry_gender' => $customers_gender, 'entry_firstname' => $customers_firstname, 'entry_lastname' => $customers_lastname, 'entry_company' => $entry_company, 'entry_street_address' => $entry_street_address, 'entry_suburb' => $entry_suburb, 'entry_postcode' => $entry_postcode, 'entry_city' => $entry_city, 'entry_country_id' => $entry_country_id, 'entry_zone_id' => $entry_zone_id, 'entry_state' => $entry_state);