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) {
         olc_redirect(olc_href_link(FILENAME_COOKIE_USAGE));
     }
     require DIR_WS_LANGUAGES . SESSION_LANGUAGE . SLASH . FILENAME_LOGIN;
     $check_customer_query = olc_db_query("select customers_id, customers_firstname, customers_password,\n\t\tcustomers_email_address, customers_default_address_id, customers_paypal_payerid from " . TABLE_CUSTOMERS . " where customers_email_address = '" . olc_db_input($email_address) . APOS);
     $check_customer = olc_db_fetch_array($check_customer_query);
     if (!olc_db_num_rows($check_customer_query)) {
         $this->away_with_you(MODULE_PAYMENT_PAYPAL_DP_TEXT_BAD_LOGIN, true);
     } else {
         if (SESSION_RECREATE == TRUE_STRING_S) {
             olc_session_recreate();
         }
         $check_country_query = olc_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'] . APOS);
         $check_country = olc_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'];
         $_SESSION['customer_id'];
         $_SESSION['customer_default_address_id'];
         $_SESSION['customer_first_name'];
         $_SESSION['customer_country_id'];
         $_SESSION['customer_zone_id'];
         $order->customer['id'] = $customer_id;
         olc_db_query(SQL_UPDATE . TABLE_CUSTOMERS_INFO . " set\n\t\t\tcustomers_info_date_of_last_logon = now(),\n\t\t\tcustomers_info_number_of_logons = customers_info_number_of_logons+1\n\t\t\twhere customers_info_id = '" . (int) $customer_id . APOS);
         $cart->restore_contents();
         $this->away_with_you();
     }
 }
示例#2
0
 $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);
 if ($IsCreateAccount) {
     $cc_id = olc_db_insert_id();
     $sql_data_array['customers_id'] = $cc_id;
 } else {
     $cc_id = olc_db_input($default_address_id);
     $parameters .= " and address_book_id = '" . $cc_id . APOS;
 }
 olc_db_perform(TABLE_ADDRESS_BOOK, $sql_data_array, $action, $parameters);
 if ($IsCreateAccount) {
     $address_id = olc_db_insert_id();
     olc_db_query(SQL_UPDATE . TABLE_CUSTOMERS . " set customers_default_address_id = '" . $address_id . "' where customers_id = '" . $cc_id . APOS);
     if ($IsUserMode) {
         olc_db_query(INSERT_INTO . TABLE_CUSTOMERS_INFO . " (customers_info_id, customers_info_number_of_logons, customers_info_date_account_created)\n\t\t\t\t\tvalues ('" . CUSTOMER_ID . "', '0', now())");
         if (SESSION_RECREATE) {
             olc_session_recreate();
         }
         // restore cart contents
         $_SESSION['cart']->restore_contents();
     } else {
         if ($customers_status_c == '0') {
             olc_db_query(INSERT_INTO . TABLE_ADMIN_ACCESS . " (customers_id,start) VALUES ('" . $cc_id . "','1')");
         }
     }
 }
 if ($IsUserMode) {
     $_SESSION['customer_first_name'] = $customers_firstname;
     $_SESSION['customer_default_address_id'] = $address_id;
     $_SESSION['customer_country_id'] = $entry_country;
     $_SESSION['customer_zone_id'] = $entry_zone_id;
 }