public static function execute(ApplicationAbstract $application) { $OSCOM_MessageStack = Registry::get('MessageStack'); $data = array(); if (DISPLAY_PRIVACY_CONDITIONS == '1') { if (isset($_POST['privacy_conditions']) === false || isset($_POST['privacy_conditions']) && $_POST['privacy_conditions'] != '1') { $OSCOM_MessageStack->add('Create', OSCOM::getDef('error_privacy_statement_not_accepted')); } } if (ACCOUNT_GENDER >= 0) { if (isset($_POST['gender']) && ($_POST['gender'] == 'm' || $_POST['gender'] == 'f')) { $data['gender'] = $_POST['gender']; } else { $OSCOM_MessageStack->add('Create', OSCOM::getDef('field_customer_gender_error')); } } if (isset($_POST['firstname']) && strlen(trim($_POST['firstname'])) >= ACCOUNT_FIRST_NAME) { $data['firstname'] = $_POST['firstname']; } else { $OSCOM_MessageStack->add('Create', sprintf(OSCOM::getDef('field_customer_first_name_error'), ACCOUNT_FIRST_NAME)); } if (isset($_POST['lastname']) && strlen(trim($_POST['lastname'])) >= ACCOUNT_LAST_NAME) { $data['lastname'] = $_POST['lastname']; } else { $OSCOM_MessageStack->add('Create', sprintf(OSCOM::getDef('field_customer_last_name_error'), ACCOUNT_LAST_NAME)); } if (ACCOUNT_DATE_OF_BIRTH == '1') { if (isset($_POST['dob_days']) && isset($_POST['dob_months']) && isset($_POST['dob_years']) && checkdate($_POST['dob_months'], $_POST['dob_days'], $_POST['dob_years'])) { $data['dob'] = mktime(0, 0, 0, $_POST['dob_months'], $_POST['dob_days'], $_POST['dob_years']); } else { $OSCOM_MessageStack->add('Create', OSCOM::getDef('field_customer_date_of_birth_error')); } } if (isset($_POST['email_address']) && strlen(trim($_POST['email_address'])) >= ACCOUNT_EMAIL_ADDRESS) { if (filter_var($_POST['email_address'], FILTER_VALIDATE_EMAIL)) { if (Account::checkEntry($_POST['email_address']) === false) { $data['email_address'] = $_POST['email_address']; } else { $OSCOM_MessageStack->add('Create', OSCOM::getDef('field_customer_email_address_exists_error')); } } else { $OSCOM_MessageStack->add('Create', OSCOM::getDef('field_customer_email_address_check_error')); } } else { $OSCOM_MessageStack->add('Create', sprintf(OSCOM::getDef('field_customer_email_address_error'), ACCOUNT_EMAIL_ADDRESS)); } if (isset($_POST['password']) === false || isset($_POST['password']) && strlen(trim($_POST['password'])) < ACCOUNT_PASSWORD) { $OSCOM_MessageStack->add('Create', sprintf(OSCOM::getDef('field_customer_password_error'), ACCOUNT_PASSWORD)); } elseif (isset($_POST['confirmation']) === false || isset($_POST['confirmation']) && trim($_POST['password']) != trim($_POST['confirmation'])) { $OSCOM_MessageStack->add('Create', OSCOM::getDef('field_customer_password_mismatch_with_confirmation')); } else { $data['password'] = $_POST['password']; } if ($OSCOM_MessageStack->size('Create') === 0) { if (Account::createEntry($data)) { $OSCOM_MessageStack->add('Create', OSCOM::getDef('success_account_updated'), 'success'); } OSCOM::redirect(OSCOM::getLink(null, null, 'Create&Success', 'SSL')); } }
public static function execute(ApplicationAbstract $application) { $OSCOM_Database = Registry::get('Database'); $OSCOM_MessageStack = Registry::get('MessageStack'); $Qcheck = $OSCOM_Database->query('select customers_id, customers_firstname, customers_lastname, customers_gender, customers_email_address, customers_password from :table_customers where customers_email_address = :customers_email_address limit 1'); $Qcheck->bindValue(':customers_email_address', $_POST['email_address']); $Qcheck->execute(); if ($Qcheck->numberOfRows() === 1) { $password = osc_create_random_string(ACCOUNT_PASSWORD); if (Account::savePassword($password, $Qcheck->valueInt('customers_id'))) { if (ACCOUNT_GENDER > -1) { if ($Qcheck->value('customers_gender') == 'm') { $email_text = sprintf(OSCOM::getDef('email_addressing_gender_male'), $Qcheck->valueProtected('customers_lastname')) . "\n\n"; } else { $email_text = sprintf(OSCOM::getDef('email_addressing_gender_female'), $Qcheck->valueProtected('customers_lastname')) . "\n\n"; } } else { $email_text = sprintf(OSCOM::getDef('email_addressing_gender_unknown'), $Qcheck->valueProtected('customers_firstname') . ' ' . $Qcheck->valueProtected('customers_lastname')) . "\n\n"; } $email_text .= sprintf(OSCOM::getDef('email_password_reminder_body'), osc_get_ip_address(), STORE_NAME, $password, STORE_OWNER_EMAIL_ADDRESS); osc_email($Qcheck->valueProtected('customers_firstname') . ' ' . $Qcheck->valueProtected('customers_lastname'), $Qcheck->valueProtected('customers_email_address'), sprintf(OSCOM::getDef('email_password_reminder_subject'), STORE_NAME), $email_text, STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS); $OSCOM_MessageStack->add('LogIn', OSCOM::getDef('success_password_forgotten_sent'), 'success'); } osc_redirect(OSCOM::getLink(null, null, 'LogIn', 'SSL')); } else { $OSCOM_MessageStack->add('PasswordForgotten', OSCOM::getDef('error_password_forgotten_no_email_address_found')); } }
public static function execute(ApplicationAbstract $application) { $OSCOM_PDO = Registry::get('PDO'); $OSCOM_MessageStack = Registry::get('MessageStack'); $Qcheck = $OSCOM_PDO->prepare('select customers_id, customers_firstname, customers_lastname, customers_gender, customers_email_address, customers_password from :table_customers where customers_email_address = :customers_email_address limit 1'); $Qcheck->bindValue(':customers_email_address', $_POST['email_address']); $Qcheck->execute(); if ($Qcheck->fetch() !== false) { $password = Hash::getRandomString(ACCOUNT_PASSWORD); if (Account::savePassword($password, $Qcheck->valueInt('customers_id'))) { if (ACCOUNT_GENDER > -1) { if ($Qcheck->value('customers_gender') == 'm') { $email_text = sprintf(OSCOM::getDef('email_addressing_gender_male'), $Qcheck->valueProtected('customers_lastname')) . "\n\n"; } else { $email_text = sprintf(OSCOM::getDef('email_addressing_gender_female'), $Qcheck->valueProtected('customers_lastname')) . "\n\n"; } } else { $email_text = sprintf(OSCOM::getDef('email_addressing_gender_unknown'), $Qcheck->valueProtected('customers_firstname') . ' ' . $Qcheck->valueProtected('customers_lastname')) . "\n\n"; } $email_text .= sprintf(OSCOM::getDef('email_password_reminder_body'), OSCOM::getIPAddress(), STORE_NAME, $password, STORE_OWNER_EMAIL_ADDRESS); $pEmail = new Mail($Qcheck->valueProtected('customers_firstname') . ' ' . $Qcheck->valueProtected('customers_lastname'), $Qcheck->valueProtected('customers_email_address'), STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS, sprintf(OSCOM::getDef('email_password_reminder_subject'), STORE_NAME)); $pEmail->setBodyPlain($email_text); $pEmail->send(); $OSCOM_MessageStack->add('LogIn', OSCOM::getDef('success_password_forgotten_sent'), 'success'); } OSCOM::redirect(OSCOM::getLink(null, null, 'LogIn', 'SSL')); } else { $OSCOM_MessageStack->add('PasswordForgotten', OSCOM::getDef('error_password_forgotten_no_email_address_found')); } }
public static function execute(ApplicationAbstract $application) { $OSCOM_MessageStack = Registry::get('MessageStack'); $OSCOM_Customer = Registry::get('Customer'); $data = array(); if (ACCOUNT_GENDER >= 0) { if (isset($_POST['gender']) && ($_POST['gender'] == 'm' || $_POST['gender'] == 'f')) { $data['gender'] = $_POST['gender']; } else { $OSCOM_MessageStack->add('Edit', OSCOM::getDef('field_customer_gender_error')); } } if (isset($_POST['firstname']) && strlen(trim($_POST['firstname'])) >= ACCOUNT_FIRST_NAME) { $data['firstname'] = $_POST['firstname']; } else { $OSCOM_MessageStack->add('Edit', sprintf(OSCOM::getDef('field_customer_first_name_error'), ACCOUNT_FIRST_NAME)); } if (isset($_POST['lastname']) && strlen(trim($_POST['lastname'])) >= ACCOUNT_LAST_NAME) { $data['lastname'] = $_POST['lastname']; } else { $OSCOM_MessageStack->add('Edit', sprintf(OSCOM::getDef('field_customer_last_name_error'), ACCOUNT_LAST_NAME)); } if (ACCOUNT_DATE_OF_BIRTH == '1') { if (isset($_POST['dob_days']) && isset($_POST['dob_months']) && isset($_POST['dob_years']) && checkdate($_POST['dob_months'], $_POST['dob_days'], $_POST['dob_years'])) { $data['dob'] = mktime(0, 0, 0, $_POST['dob_months'], $_POST['dob_days'], $_POST['dob_years']); } else { $OSCOM_MessageStack->add('Edit', OSCOM::getDef('field_customer_date_of_birth_error')); } } if (isset($_POST['email_address']) && strlen(trim($_POST['email_address'])) >= ACCOUNT_EMAIL_ADDRESS) { if (osc_validate_email_address($_POST['email_address'])) { if (Account::checkDuplicateEntry($_POST['email_address']) === false) { $data['email_address'] = $_POST['email_address']; } else { $OSCOM_MessageStack->add('Edit', OSCOM::getDef('field_customer_email_address_exists_error')); } } else { $OSCOM_MessageStack->add('Edit', OSCOM::getDef('field_customer_email_address_check_error')); } } else { $OSCOM_MessageStack->add('Edit', sprintf(OSCOM::getDef('field_customer_email_address_error'), ACCOUNT_EMAIL_ADDRESS)); } if ($OSCOM_MessageStack->size('Edit') === 0) { if (Account::saveEntry($data)) { // reset the session variables if (ACCOUNT_GENDER > -1) { $OSCOM_Customer->setGender($data['gender']); } $OSCOM_Customer->setFirstName(trim($data['firstname'])); $OSCOM_Customer->setLastName(trim($data['lastname'])); $OSCOM_Customer->setEmailAddress($data['email_address']); $OSCOM_MessageStack->add('Account', OSCOM::getDef('success_account_updated'), 'success'); } osc_redirect(OSCOM::getLink(null, null, null, 'SSL')); } }
public static function execute(ApplicationAbstract $application) { $OSCOM_NavigationHistory = Registry::get('NavigationHistory'); $OSCOM_MessageStack = Registry::get('MessageStack'); if (!empty($_POST['email_address']) && !empty($_POST['password']) && Account::logIn($_POST['email_address'], $_POST['password'])) { $OSCOM_NavigationHistory->removeCurrentPage(); if ($OSCOM_NavigationHistory->hasSnapshot()) { $OSCOM_NavigationHistory->redirectToSnapshot(); } else { osc_redirect(OSCOM::getLink(null, OSCOM::getDefaultSiteApplication(), null, 'AUTO')); } } $OSCOM_MessageStack->add('LogIn', OSCOM::getDef('error_login_no_match')); }
public static function execute(ApplicationAbstract $application) { $OSCOM_MessageStack = Registry::get('MessageStack'); if (!isset($_POST['password_current']) || strlen(trim($_POST['password_current'])) < ACCOUNT_PASSWORD) { $OSCOM_MessageStack->add('Password', sprintf(OSCOM::getDef('field_customer_password_current_error'), ACCOUNT_PASSWORD)); } elseif (!isset($_POST['password_new']) || strlen(trim($_POST['password_new'])) < ACCOUNT_PASSWORD) { $OSCOM_MessageStack->add('Password', sprintf(OSCOM::getDef('field_customer_password_new_error'), ACCOUNT_PASSWORD)); } elseif (!isset($_POST['password_confirmation']) || trim($_POST['password_new']) != trim($_POST['password_confirmation'])) { $OSCOM_MessageStack->add('Password', OSCOM::getDef('field_customer_password_new_mismatch_with_confirmation_error')); } if ($OSCOM_MessageStack->size('Password') === 0) { if (Account::checkPassword(trim($_POST['password_current']))) { if (Account::savePassword(trim($_POST['password_new']))) { $OSCOM_MessageStack->add('Account', OSCOM::getDef('success_password_updated'), 'success'); osc_redirect(OSCOM::getLink(null, null, null, 'SSL')); } else { $OSCOM_MessageStack->add('Password', sprintf(OSCOM::getDef('field_customer_password_new_error'), ACCOUNT_PASSWORD)); } } else { $OSCOM_MessageStack->add('Password', OSCOM::getDef('error_current_password_not_matching')); } } }
<?php /** * osCommerce Online Merchant * * @copyright Copyright (c) 2011 osCommerce; http://www.oscommerce.com * @license BSD License; http://www.oscommerce.com/bsdlicense.txt */ use osCommerce\OM\Core\HTML; use osCommerce\OM\Core\OSCOM; use osCommerce\OM\Core\Site\Shop\Account; $Qaccount = Account::getEntry(); ?> <h1><?php echo $OSCOM_Template->getPageTitle(); ?> </h1> <?php if ($OSCOM_MessageStack->exists('Edit')) { echo $OSCOM_MessageStack->get('Edit'); } ?> <form name="account_edit" action="<?php echo OSCOM::getLink(null, null, 'Edit&Process', 'SSL'); ?> " method="post" onsubmit="return check_form(account_edit);"> <div class="moduleBox">