add('login', $fail_reason);
}
if (isset($HTTP_GET_VARS['action']) && ($HTTP_GET_VARS['action'] == 'process')) {
$email_address = tep_db_prepare_input($HTTP_POST_VARS['email_address']);
$password = tep_db_prepare_input($HTTP_POST_VARS['password']);
// +Login Page a la Amazon
$new_customer = tep_db_prepare_input($HTTP_POST_VARS['new_customer']);
$lpala_new = false; // New customer?
$lpala_account_exists = false; // Give 'account exists' error?
if ($new_customer == 'Y') {
if (!tep_session_is_registered('login_email_address')) tep_session_register('login_email_address');
$login_email_address = $email_address;
$lpala_new = true;
}
// Check if email exists
// BOF Separate Pricing per Customer
/* $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) . "'"); */
$check_customer_query = tep_db_query("select customers_id, customers_firstname, customers_lastname, customers_group_id, customers_password, customers_email_address, customers_default_address_id from " . TABLE_CUSTOMERS . " where customers_email_address = '" . tep_db_input($email_address) . "'");
// EOF Separate Pricing Per Customer
if (!tep_db_num_rows($check_customer_query)) {
// If the user said that they are a new customer and the account does not exist,
// redirect to Create Account
if ($lpala_new) {tep_redirect(tep_href_link(FILENAME_CREATE_ACCOUNT,'','SSL'));}
$error = true;
} else if ($lpala_new) {
// We get here if the user said they are new but the account exists
$lpala_error = true;
// -Login Page a la Amazon
} 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();
}
// BOF Separate Pricing Per Customer: choice for logging in under any customer_group_id
// note that tax rates depend on your registered address!
if ($_GET['skip'] != 'true' && $_POST['email_address'] == SPPC_TOGGLE_LOGIN_PASSWORD ) {
$existing_customers_query = tep_db_query("select customers_group_id, customers_group_name from " . TABLE_CUSTOMERS_GROUPS . " order by customers_group_id ");
echo '
';
print ("\n\n
\nChoose a Customer Group\n\n\n");
echo '';
print ("\n