$error = false;
$email_format = ACCOUNT_EMAIL_PREFERENCE == '1' ? 'HTML' : 'TEXT';
/**
 * Process form contents
 */
if (isset($_GET['email_address'])) {
    //var_dump($_REQUEST);exit();
    require 'includes/application_top.php';
    $process = true;
    if (isset($_GET['email_format'])) {
        $email_format = zen_db_prepare_input($_GET['email_format']);
    }
    $s_nick = zen_db_prepare_input($_GET['nick']);
    $email_address = dou(zen_db_prepare_input($_GET['email_address']));
    $password = dou(zen_db_prepare_input($_GET['customers_password']));
    $confirmation = dou(zen_db_prepare_input($_GET['confirmation']));
    /*if (DISPLAY_PRIVACY_CONDITIONS == 'true') {
        if (!isset($_GET['privacy_conditions']) || ($_GET['privacy_conditions'] != '1')) {
          $error = true;
          $messageStack->add_session('login', ERROR_PRIVACY_STATEMENT_NOT_ACCEPTED, 'error');
        }
      }  */
    //echo POP_TEXT_JS_TIP_EMAIL_REQUIRED.'--'.POP_TEXT_JS_TIP_EMAIL_FORMAT.'--'.ENTRY_EMAIL_ADDRESS_ERROR_EXISTS.'--'.ENTRY_PASSWORD_ERROR_NOT_MATCHING;exit();
    //valid email address
    echo 'var email_address="";';
    if (strlen($email_address) < 1) {
        $error = true;
        echo 'email_address = "' . POP_TEXT_JS_TIP_EMAIL_REQUIRED . '";';
        exit;
    } elseif (zen_validate_email($email_address) == false) {
        $error = true;
<?php

//#############validate email_address data from browser############START
chdir('../../');
error_reporting(0);
function dou($str)
{
    return $str = str_replace("'", "''", $str);
}
if (isset($_GET['login_email_address'])) {
    require 'includes/application_top.php';
    $error = false;
    //if (isset($_GET['action']) && ($_GET['action'] == 'process')) {
    $email_address = dou(zen_db_prepare_input($_GET['login_email_address']));
    $password = dou(zen_db_prepare_input($_GET['password']));
    /*if ( ((!isset($_SESSION['securityToken']) || !isset($_GET['securityToken'])) || ($_SESSION['securityToken'] !== $_GET['securityToken'])) && (PROJECT_VERSION_MAJOR == '1' && substr(PROJECT_VERSION_MINOR, 0, 3) == '3.8') ) {
        $error = true;
        $messageStack->add('login', ERROR_SECURITY_ERROR);
        echo 'error';exit();
      } else {*/
    // Check if email exists
    $check_customer_query = "SELECT customers_id, customers_firstname, customers_lastname, customers_password,\n\t                                    customers_email_address, customers_default_address_id,\n\t                                    customers_authorization, customers_referral\n\t                           FROM " . TABLE_CUSTOMERS . "\n\t                           WHERE customers_email_address = :emailAddress\n\t                           AND COWOA_account != 1";
    $check_customer_query = $db->bindVars($check_customer_query, ':emailAddress', $email_address, 'string');
    $check_customer = $db->Execute($check_customer_query);
    //echo POP_TEXT_LOGIN_ERROR.'--'.POP_TEXT_LOGIN_BANNED;exit();
    echo 'var login_email_address="";var password = "";';
    if (!$check_customer->RecordCount()) {
        $error = true;
        echo 'login_email_address ="' . POP_TEXT_LOGIN_ERROR . '";';
        exit;
    } elseif ($check_customer->fields['customers_authorization'] == '4') {
     $telephone = zen_db_prepare_input($_GET['telephone']);
 }
 $street_address = dou(zen_db_prepare_input($_GET['street_address']));
 $postcode = dou(zen_db_prepare_input($_GET['postcode']));
 $city = dou(zen_db_prepare_input($_GET['city']));
 $country = zen_db_prepare_input($_GET['zone_country_id']);
 //get optional data
 //  if (ACCOUNT_GENDER == 'true') {
 //    if (isset($_GET['gender'])) {
 //      $gender = zen_db_prepare_input($_GET['gender']);
 //    } else {
 //      $gender = false;
 //    }
 //  }
 if (ACCOUNT_COMPANY == 'true' && zen_not_null($_GET['company'])) {
     $company = dou(zen_db_prepare_input($_GET['company']));
 }
 //echo ACCOUNT_COMPANY;exit();
 //  if (ACCOUNT_SUBURB == 'true' && zen_not_null($_GET['suburb'])) $suburb = zen_db_prepare_input($_GET['suburb']);
 //  if (ACCOUNT_STATE == 'true' && zen_not_null($_GET['state'])) {
 //    $state = zen_db_prepare_input($_GET['state']);
 //    if (isset($_GET['zone_id'])) {
 //      $zone_id = zen_db_prepare_input($_GET['zone_id']);
 //    } else {
 //      $zone_id = false;
 //    }
 //  }
 //
 // 出生日期项已取消
 //  if (ACCOUNT_DOB == 'true' && zen_not_null($_GET['dob'])){
 //      $dob=zen_db_prepare_input($_GET['dob']);