$error = true;
             $messageStack->add('account_edit', WARNING_FILE_UPLOADS_DISABLED, '');
         }
         $customersStore->set_store_logo('store_image');
         $doUpload = true;
     }
     if ($doUpload === true) {
         $error_text = $customersStore->put_logo_image();
         if ($error_text != '') {
             $error = true;
             $messageStack->add('account_edit', $error_text, '');
         }
     }
 }
 if ($error === false) {
     $customerInfo->set_firstname($customer_first_name);
     $customerInfo->set_lastname($lastname);
     $customerInfo->set_email_address($email_address);
     $customerInfo->set_dob($dob);
     $customerInfo->set_street_address($street_address);
     $customerInfo->set_postcode($postcode);
     $customerInfo->set_city($city);
     $customerInfo->set_country_id($customer_country_id);
     $customerInfo->set_company($company);
     $customerInfo->set_zone_id($customer_zone_id);
     $customerInfo->set_state($state);
     $customerInfo->set_telephone($telephone);
     $customerInfo->set_tollfree($tollfree);
     $customerInfo->set_fax($fax);
     $customerInfo->set_newsletter($newsletter);
     if (isset($_POST['affiliate_id'])) {
         $error = true;
         $messageStack->add('create_store_account', ENTRY_STATE_ERROR);
     }
 }
 if (strlen($password) < ENTRY_PASSWORD_MIN_LENGTH) {
     $error = true;
     $messageStack->add('create_store_account', ENTRY_PASSWORD_ERROR);
 } elseif ($password != $confirmation) {
     $error = true;
     $messageStack->add('create_store_account', ENTRY_PASSWORD_ERROR_NOT_MATCHING);
 }
 if ($error == false) {
     if (!smn_session_is_registered('customer_id')) {
         //ADD THE STORE OWNER DATA ....
         $new_customer = new customer();
         $new_customer->set_firstname($customer_first_name);
         $new_customer->set_lastname($lastname);
         $new_customer->set_email_address($email_address);
         $new_customer->set_telephone($telephone);
         $new_customer->set_fax($fax);
         $new_customer->set_newsletter($newsletter);
         $new_customer->set_password($password);
         $new_customer->set_gender($gender);
         $new_customer->set_dob($dob);
         $new_customer->set_street_address($street_address);
         $new_customer->set_postcode($postcode);
         $new_customer->set_city($city);
         $new_customer->set_country_id($customer_country_id);
         $new_customer->set_company($company);
         $new_customer->set_zone_id($customer_zone_id);
         $new_customer->set_state($state);
 // Check Newsletter
 $entry_newsletter_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) {
     /* Added sales agent data in customer table by cimi on June 13,2007 */
     if (!smn_session_is_registered('customer_id')) {
         //ADD THE STORE OWNER DATA ....
         $new_customer = new customer();
         $new_customer->set_firstname($a_firstname);
         $new_customer->set_lastname($a_lastname);
         $new_customer->set_email_address($a_email_address);
         $new_customer->set_telephone($a_telephone);
         $new_customer->set_fax($a_fax);
         $new_customer->set_newsletter($a_newsletter);
         $new_customer->set_password($a_password);
         $new_customer->set_gender($a_gender);
         $new_customer->set_dob($a_dob);
         $new_customer->set_street_address($a_street_address);
         $new_customer->set_postcode($a_postcode);
         $new_customer->set_city($a_city);
         $new_customer->set_country_id($a_country);
         $new_customer->set_company($a_company);
         $new_customer->set_zone_id($a_zone_id);
         $new_customer->set_state($a_state);
 if (!smn_validate_email($_POST['email_address'])) {
     $error = true;
     $messageStack->add('account_edit', ENTRY_EMAIL_ADDRESS_CHECK_ERROR);
 }
 $check_email_query = smn_db_query("select count(*) as total from " . TABLE_CUSTOMERS . " where customers_email_address = '" . smn_db_input($_POST['email_address']) . "' and customers_id != '" . (int) $customer_id . "'");
 $check_email = smn_db_fetch_array($check_email_query);
 if ($check_email['total'] > 0) {
     $error = true;
     $messageStack->add('account_edit', ENTRY_EMAIL_ADDRESS_ERROR_EXISTS);
 }
 if (strlen($_POST['telephone']) < ENTRY_TELEPHONE_MIN_LENGTH) {
     $error = true;
     $messageStack->add('account_edit', ENTRY_TELEPHONE_NUMBER_ERROR);
 }
 if ($error == false) {
     $profile_edit->set_firstname($_POST['firstname']);
     $profile_edit->set_lastname($_POST['lastname']);
     $profile_edit->set_email_address($_POST['email_address']);
     $profile_edit->set_telephone($_POST['telephone']);
     $profile_edit->set_fax($_POST['fax']);
     $profile_edit->set_newsletter($newsletter);
     $profile_edit->set_gender($_POST['customers_gender']);
     $profile_edit->set_dob($_POST['customers_dob']);
     $profile_edit->set_street_address($_POST['street_address']);
     $profile_edit->set_postcode($_POST['postcode']);
     $profile_edit->set_city($_POST['city']);
     $profile_edit->set_country_id($_POST['country']);
     $profile_edit->set_company($_POST['company']);
     if ($zone_id > 0) {
         $L_state = smn_get_zone_name($_POST['country'], $zone_id, '');
         $profile_edit->set_zone_id($zone_id);
 	  $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) {
     /*Added the code to edit the details in the customer table,by Cimi*/
     $profile_edit->set_firstname($a_firstname);
     $profile_edit->set_lastname($a_lastname);
     $profile_edit->set_email_address($a_email_address);
     $profile_edit->set_telephone($a_telephone);
     $profile_edit->set_fax($a_fax);
     $profile_edit->set_newsletter($newsletter);
     $profile_edit->set_gender($a_gender);
     $profile_edit->set_dob($a_dob);
     $profile_edit->set_street_address($a_street_address);
     $profile_edit->set_postcode($a_postcode);
     $profile_edit->set_city($a_city);
     $profile_edit->set_country_id($a_country);
     $profile_edit->set_company($a_company);
     if ($a_zone_id > 0) {
         $L_state = smn_get_zone_name($a_country, $a_zone_id, '');
         $profile_edit->set_zone_id($a_zone_id);
 $check_new_store_type = smn_set_store_type($new_store_type);
 $store_products_id = smn_set_products_id($new_store_type);
 //CREATE STORE IN THE DATABASE.....
 if ($_GET['action'] == 'update') {
     smn_session_register('customers_id');
     $customer_info = new customer($customers_id);
     $store_info = new store((int) $_GET['sID']);
 } else {
     if (!smn_session_is_registered('cart') && !is_object($cart)) {
         smn_session_register('cart');
         $cart = new shoppingCart();
     }
     $customer_info = new customer();
     $store_info = new store();
 }
 $customer_info->set_firstname($firstname);
 $customer_info->set_lastname($lastname);
 $customer_info->set_email_address($email_address);
 $customer_info->set_telephone($telephone);
 $customer_info->set_fax($fax);
 $customer_info->set_newsletter($newsletter);
 $customer_info->set_gender($gender);
 //    $customer_info->set_dob($dob);
 $customer_info->set_street_address($street_address);
 $customer_info->set_postcode($postal_code);
 $customer_info->set_city($city);
 $customer_info->set_country_id($country);
 $customer_info->set_company($company);
 if ($_GET['action'] == 'process') {
     $customer_info->set_password($password);
 }