0byt3m1n1 - D7net
0byt3m1n1 - D7net
Path:
/
home
/
s13cf5ef
/
www
/
tuscamisetaspersonalizadas.es
/
[
Home
]
Name File: account_edit.php
< back
<?php /* $Id: account_edit.php 1739 2007-12-20 00:52:16Z hpdl $ osCommerce, Open Source E-Commerce Solutions http://www.oscommerce.com Copyright (c) 2003 osCommerce Released under the GNU General Public License */ require('includes/application_top.php'); if (!tep_session_is_registered('customer_id')) { $navigation->set_snapshot(); tep_redirect(tep_href_link(FILENAME_LOGIN, '', 'SSL')); } // needs to be included earlier to set the success message in the messageStack require(DIR_WS_LANGUAGES . $language . '/' . FILENAME_ACCOUNT_EDIT); if (isset($HTTP_POST_VARS['action']) && ($HTTP_POST_VARS['action'] == 'process')) { if (ACCOUNT_GENDER == 'true') $gender = tep_db_prepare_input($HTTP_POST_VARS['gender']); $firstname = tep_db_prepare_input($HTTP_POST_VARS['firstname']); $lastname = tep_db_prepare_input($HTTP_POST_VARS['lastname']); if (ACCOUNT_DOB == 'true') $dob = tep_db_prepare_input($HTTP_POST_VARS['dob']); $email_address = tep_db_prepare_input($HTTP_POST_VARS['email_address']); $telephone = tep_db_prepare_input($HTTP_POST_VARS['telephone']); $fax = tep_db_prepare_input($HTTP_POST_VARS['fax']); //NIF start if (ACCOUNT_NIF == 'true') $nif = tep_db_prepare_input($HTTP_POST_VARS['nif']); //NIF end $error = false; if (ACCOUNT_GENDER == 'true') { if ( ($gender != 'm') && ($gender != 'f') ) { $error = true; $messageStack->add('account_edit', ENTRY_GENDER_ERROR); } } //NIF start // NIF Requerido solo Espaņa start $pais_query = tep_db_query("select entry_country_id from " . TABLE_ADDRESS_BOOK . " where customers_id = '" . (int)$customer_id . "'"); $pais = tep_db_fetch_array($pais_query); if ((ACCOUNT_NIF == 'true') && ($pais['entry_country_id'] == "195")) { // NIF Requerido solo Espaņa end if (($nif == "") && (ACCOUNT_NIF_REQ == 'true')) { $error = true; $messageStack->add('account_edit', ENTRY_NO_NIF_ERROR); } else if ((strlen($nif) != 9) && ($nif != "")) { $error = true; $messageStack->add('account_edit', ENTRY_FORMATO_NIF_ERROR); } else if (strlen($nif) == 9) { $result = tep_valida_nif_cif_nie($nif); if ($result <= 0) { $error = true; $messageStack->add('account_edit', ENTRY_FORMATO_NIF_ERROR); } else { //correcto } } else { //correcto } } //NIF end if (strlen($firstname) < ENTRY_FIRST_NAME_MIN_LENGTH) { $error = true; $messageStack->add('account_edit', ENTRY_FIRST_NAME_ERROR); } if (strlen($lastname) < ENTRY_LAST_NAME_MIN_LENGTH) { $error = true; $messageStack->add('account_edit', ENTRY_LAST_NAME_ERROR); } if (ACCOUNT_DOB == 'true') { if (!checkdate(substr(tep_date_raw($dob), 4, 2), substr(tep_date_raw($dob), 6, 2), substr(tep_date_raw($dob), 0, 4))) { $error = true; $messageStack->add('account_edit', ENTRY_DATE_OF_BIRTH_ERROR); } } if (strlen($email_address) < ENTRY_EMAIL_ADDRESS_MIN_LENGTH) { $error = true; $messageStack->add('account_edit', ENTRY_EMAIL_ADDRESS_ERROR); } if (!tep_validate_email($email_address)) { $error = true; $messageStack->add('account_edit', ENTRY_EMAIL_ADDRESS_CHECK_ERROR); } $check_email_query = tep_db_query("select count(*) as total from " . TABLE_CUSTOMERS . " where customers_email_address = '" . tep_db_input($email_address) . "' and customers_id != '" . (int)$customer_id . "'"); $check_email = tep_db_fetch_array($check_email_query); if ($check_email['total'] > 0) { $error = true; $messageStack->add('account_edit', ENTRY_EMAIL_ADDRESS_ERROR_EXISTS); } if (strlen($telephone) < ENTRY_TELEPHONE_MIN_LENGTH) { $error = true; $messageStack->add('account_edit', ENTRY_TELEPHONE_NUMBER_ERROR); } if ($error == false) { $sql_data_array = array('customers_firstname' => $firstname, 'customers_lastname' => $lastname, 'customers_email_address' => $email_address, 'customers_telephone' => $telephone, 'customers_fax' => $fax); if (ACCOUNT_GENDER == 'true') $sql_data_array['customers_gender'] = $gender; if (ACCOUNT_DOB == 'true') $sql_data_array['customers_dob'] = tep_date_raw($dob); tep_db_perform(TABLE_CUSTOMERS, $sql_data_array, 'update', "customers_id = '" . (int)$customer_id . "'"); tep_db_query("update " . TABLE_CUSTOMERS_INFO . " set customers_info_date_account_last_modified = now() where customers_info_id = '" . (int)$customer_id . "'"); $sql_data_array = array('entry_firstname' => $firstname, 'entry_lastname' => $lastname); //NIF start if (ACCOUNT_NIF == 'true') $sql_data_array['entry_nif'] = $nif; //NIF end tep_db_perform(TABLE_ADDRESS_BOOK, $sql_data_array, 'update', "customers_id = '" . (int)$customer_id . "' and address_book_id = '" . (int)$customer_default_address_id . "'"); // reset the session variables $customer_first_name = $firstname; $messageStack->add_session('account', SUCCESS_ACCOUNT_UPDATED, 'success'); tep_redirect(tep_href_link(FILENAME_ACCOUNT, '', 'SSL')); } } //NIF start $account_query = tep_db_query("select c.customers_gender, c.customers_firstname, c.customers_lastname, c.customers_dob, c.customers_email_address, c.customers_telephone, c.customers_fax, a.entry_country_id, a.entry_nif from " . TABLE_CUSTOMERS . " c left join " . TABLE_ADDRESS_BOOK . " a on c.customers_default_address_id = a.address_book_id where a.customers_id = c.customers_id and c.customers_id = '" . (int)$customer_id . "'"); //NIF end $account = tep_db_fetch_array($account_query); $breadcrumb->add(NAVBAR_TITLE_1, tep_href_link(FILENAME_ACCOUNT, '', 'SSL')); $breadcrumb->add(NAVBAR_TITLE_2, tep_href_link(FILENAME_ACCOUNT_EDIT, '', 'SSL')); ?> <!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN"> <html <?php echo HTML_PARAMS; ?>> <head> <?php require(DIR_WS_INCLUDES . 'header_tags.php'); require(DIR_WS_INCLUDES . 'header_includes.php'); ?> <?php require('includes/form_check.js.php'); ?> </head> <body> <!-- header //--> <?php $tab_sel = 5; ?> <?php require(DIR_WS_INCLUDES . 'header.php'); ?> <!-- header_eof //--> <!-- body //--> <table border="0" class="<?php echo MAIN_TABLE; ?>" cellspacing="0" cellpadding="0" align="center"> <tr> <td class="<?php echo BOX_WIDTH_TD_LEFT; ?>"><table border="0" class="<?php echo BOX_WIDTH_LEFT; ?>" cellspacing="0" cellpadding="0"> <!-- left_navigation //--> <?php require(DIR_WS_INCLUDES . 'column_left.php'); ?> <!-- left_navigation_eof //--> </table></td> <!-- body_text //--> <td class="<?php echo CONTENT_WIDTH_TD; ?>"><?php include(DIR_WS_BOXES . 'panel_top.php');?><?php echo tep_draw_form('account_edit', tep_href_link(FILENAME_ACCOUNT_EDIT, '', 'SSL'), 'post', 'onSubmit="return check_form(account_edit);"') . tep_draw_hidden_field('action', 'process'); ?> <?php echo tep_draw_top();?> <?php echo tep_draw_title_top();?> <?php echo HEADING_TITLE; ?> <?php echo tep_draw_title_bottom();?> <?php echo tep_draw1_top();?> <?php if ($messageStack->size('account_edit') > 0) { ?> <table cellpadding="0" cellspacing="0" border="0"> <tr> <td><?php echo $messageStack->output('account_edit'); ?></td> </tr> <tr> <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td> </tr> </table> <?php } ?> <table border="0" width="100%" cellspacing="0" cellpadding="2"> <tr> <td class="main indent_2"><b><?php echo MY_ACCOUNT_TITLE; ?></b></td> <td class="inputRequirement" align="right"><?php echo FORM_REQUIRED_INFORMATION; ?></td> </tr> </table> <?php echo tep_draw_infoBox_top();?> <table border="0" cellspacing="2" cellpadding="2"> <?php if (ACCOUNT_GENDER == 'true') { if (isset($gender)) { $male = ($gender == 'm') ? true : false; } else { $male = ($account['customers_gender'] == 'm') ? true : false; } $female = !$male; ?> <tr> <td class="main"><?php echo ENTRY_GENDER; ?></td> <td class="main"><?php echo tep_draw_radio_field('gender', 'm', $male) . ' ' . MALE . ' ' . tep_draw_radio_field('gender', 'f', $female) . ' ' . FEMALE . ' ' . (tep_not_null(ENTRY_GENDER_TEXT) ? '<span class="inputRequirement">' . ENTRY_GENDER_TEXT . '</span>': ''); ?></td> </tr> <?php } ?> <tr> <td class="main"><?php echo ENTRY_FIRST_NAME; ?></td> <td class="main"><?php echo tep_draw_input_field('firstname', $account['customers_firstname']) . ' ' . (tep_not_null(ENTRY_FIRST_NAME_TEXT) ? '<span class="inputRequirement">' . ENTRY_FIRST_NAME_TEXT . '</span>': ''); ?></td> </tr> <tr> <td class="main"><?php echo ENTRY_LAST_NAME; ?></td> <td class="main"><?php echo tep_draw_input_field('lastname', $account['customers_lastname']) . ' ' . (tep_not_null(ENTRY_LAST_NAME_TEXT) ? '<span class="inputRequirement">' . ENTRY_LAST_NAME_TEXT . '</span>': ''); ?></td> </tr> <!--NIF start--> <?php if (ACCOUNT_NIF == 'true') { ?> <tr> <td class="main"><?php echo ENTRY_NIF; ?></td> <td class="main"><?php echo tep_draw_input_field('nif', $account['entry_nif']) . ' ' . ((tep_not_null(ENTRY_NIF_TEXT) && (ACCOUNT_NIF_REQ == 'true') && ($account['entry_country_id'] == "195")) ? '<span class="inputRequirement">' . ENTRY_NIF_TEXT . '</span>': '') . ' ' . ((tep_not_null(ENTRY_NIF_EXAMPLE)) ? '<span class="inputRequirement">' . ENTRY_NIF_EXAMPLE . '</span>': ''); ?></td> </tr> <?php } ?> <!--NIF end--> <?php if (ACCOUNT_DOB == 'true') { ?> <tr> <td class="main"><?php echo ENTRY_DATE_OF_BIRTH; ?></td> <td class="main"><?php echo tep_draw_input_field('dob', tep_date_short($account['customers_dob'])) . ' ' . (tep_not_null(ENTRY_DATE_OF_BIRTH_TEXT) ? '<span class="inputRequirement">' . ENTRY_DATE_OF_BIRTH_TEXT . '</span>': ''); ?></td> </tr> <?php } ?> <tr> <td class="main"><?php echo ENTRY_EMAIL_ADDRESS; ?></td> <td class="main"><?php echo tep_draw_input_field('email_address', $account['customers_email_address']) . ' ' . (tep_not_null(ENTRY_EMAIL_ADDRESS_TEXT) ? '<span class="inputRequirement">' . ENTRY_EMAIL_ADDRESS_TEXT . '</span>': ''); ?></td> </tr> <tr> <td class="main"><?php echo ENTRY_TELEPHONE_NUMBER; ?></td> <td class="main"><?php echo tep_draw_input_field('telephone', $account['customers_telephone']) . ' ' . (tep_not_null(ENTRY_TELEPHONE_NUMBER_TEXT) ? '<span class="inputRequirement">' . ENTRY_TELEPHONE_NUMBER_TEXT . '</span>': ''); ?></td> </tr> <tr> <td class="main"><?php echo ENTRY_FAX_NUMBER; ?></td> <td class="main"><?php echo tep_draw_input_field('fax', $account['customers_fax']) . ' ' . (tep_not_null(ENTRY_FAX_NUMBER_TEXT) ? '<span class="inputRequirement">' . ENTRY_FAX_NUMBER_TEXT . '</span>': ''); ?></td> </tr> </table> <?php echo tep_draw_infoBox_bottom();?> <?php echo tep_pixel_trans();?> <?php echo tep_draw_infoBox2_top();?> <table border="0" width="100%" cellspacing="0" cellpadding="2"> <tr><td><?php echo '<a href="' . tep_href_link(FILENAME_ACCOUNT, '', 'SSL') . '">' . tep_image_button('button_back1.png', IMAGE_BUTTON_BACK) . '</a>'; ?></td> <td align="right" class="vam"><?php echo tep_image_submit('button_continue.png', IMAGE_BUTTON_CONTINUE); ?></td></tr> </table> <?php echo tep_draw_infoBox2_bottom();?> <?php echo tep_draw1_bottom();?> <?php echo tep_draw_bottom();?> </form></td> <!-- body_text_eof //--> <td class="<?php echo BOX_WIDTH_TD_RIGHT; ?>"><table border="0" class="<?php echo BOX_WIDTH_RIGHT; ?>" cellspacing="0" cellpadding="0"> <!-- right_navigation //--> <?php require(DIR_WS_INCLUDES . 'column_right.php'); ?> <!-- right_navigation_eof //--> </table></td> </tr> </table> <!-- body_eof //--> <!-- footer //--> <?php require(DIR_WS_INCLUDES . 'footer.php'); ?> <!-- footer_eof //--> </body> <?php require(DIR_WS_INCLUDES . 'footer_includes.php'); ?> </html> <?php require(DIR_WS_INCLUDES . 'application_bottom.php'); ?>
©
2018. | Recode by D7net