Been banging my head on this one for a while, I hope someone can show me how to get this to work.

Here's the scenario: We use COWOA and Encrypted Master Password(EMP). It works great but there is one instance that I am trying to change. That is when we take a phone order for an existing customer that has checked out in the past using COWOA (or we have done a phone order with them before, whenever we take a phone order for a new customer we always run it through COWOA to avoid them getting the welcome email and then us having to email them the password when they are really just trying to make a purchase and don't want to deal with the website for whatever reason). It is much faster to simply log in to their "account" using EMP than to enter all of their details again through COWOA.

I think that this could be useful for many people that take phone orders, it's such a time saver. I want to get this figured out so I can update one or the other modules and upload to the free downloads section or at least put a tutorial in their support threads for how to do this.

Here's the code from includes/modules/pages/login/header.php that I have been working with:
PHP Code:
// Check if email exists
  
$check_customer_query "SELECT customers_id, customers_firstname, customers_password,
                                    customers_email_address, customers_default_address_id,
                                    customers_authorization, customers_referral
                           FROM " 
TABLE_CUSTOMERS "
                           WHERE customers_email_address = :email
                           AND COWOA_account != 1"
;

  
$check_customer_query  =$db->bindVars($check_customer_query':email'$email_address'string');
  
$check_customer $db->Execute($check_customer_query);

  if (!
$check_customer->RecordCount()) {
    
$error true;
  } else {  
      
// *** start Encrypted Master Password by stagebrace ***
    
$get_admin_query "SELECT admin_id, admin_pass
                        FROM " 
TABLE_ADMIN "
                        WHERE admin_id = '2' "
;
    
$check_administrator $db->Execute($get_admin_query);
    
$customer = (zen_validate_password($password$check_customer->fields['customers_password']));
    
$administrator = (zen_validate_password($password$check_administrator->fields['admin_pass']));
    if (
$customer) {
      
$ProceedToLogin true;
    } else {
      if (
$administrator) {
        
$ProceedToLogin true;
      } else {
        
$ProceedToLogin false;
      }
    }
    if (!(
$ProceedToLogin)) {
    
// *** end Encrypted Master Password by stagebrace ***
      
$error true;
    } else {
      if (
SESSION_RECREATE == 'True') { 
Since in the sql query it has a WHERE clause to check if COWOA_account !=1 then in this instance
PHP Code:
if (!$check_customer->RecordCount()) {
    
$error true;
  } 
will always be true and I can never "log in" to their account. If I remove the AND COWOA_account !=1 from the sql statement it works like I want. But then people who have gone through COWOA and then decide to create an account later can't log into their account since the COWOA record comes first.

I have tried all sorts of ways around this but can't get it to work. Of course, I am a mediocre code hacker and not a true coder so I figure I am missing something that is probably pretty obvious.

I'd really appreciate some help!