[ Index ]
 

Code source de Zen Cart E-Commerce Shopping Cart 1.3.7.1

Accédez au Source d'autres logiciels libres

Classes | Fonctions | Variables | Constantes | Tables

title

Body

[fermer]

/includes/modules/pages/password_forgotten/ -> header_php.php (source)

   1  <?php
   2  /**

   3   * Password Forgotten

   4   * 

   5   * @package page

   6   * @copyright Copyright 2003-2006 Zen Cart Development Team

   7   * @copyright Portions Copyright 2003 osCommerce

   8   * @license http://www.zen-cart.com/license/2_0.txt GNU Public License V2.0

   9   * @version $Id: header_php.php 2982 2006-02-07 07:56:41Z birdbrain $

  10   */
  11  
  12  // This should be first line of the script:

  13  $zco_notifier->notify('NOTIFY_HEADER_START_PASSWORD_FORGOTTEN');
  14  
  15  
  16  require(DIR_WS_MODULES . zen_get_module_directory('require_languages.php'));
  17  
  18  // remove from snapshot

  19  $_SESSION['navigation']->remove_current_page();
  20  
  21  if (isset($_GET['action']) && ($_GET['action'] == 'process')) {
  22    $email_address = zen_db_prepare_input($_POST['email_address']);
  23  
  24    $check_customer_query = "SELECT customers_firstname, customers_lastname, customers_password, customers_id 
  25                             FROM " . TABLE_CUSTOMERS . "
  26                             WHERE customers_email_address = :emailAddress";
  27  
  28    $check_customer_query = $db->bindVars($check_customer_query, ':emailAddress', $email_address, 'string');
  29    $check_customer = $db->Execute($check_customer_query);
  30  
  31    if ($check_customer->RecordCount() > 0) {
  32  
  33      $new_password = zen_create_random_value(ENTRY_PASSWORD_MIN_LENGTH);
  34      $crypted_password = zen_encrypt_password($new_password);
  35  
  36      $sql = "UPDATE " . TABLE_CUSTOMERS . "
  37              SET customers_password = :password
  38              WHERE customers_id = :customersID";
  39  
  40      $sql = $db->bindVars($sql, ':password', $crypted_password, 'string');
  41      $sql = $db->bindVars($sql, ':customersID', $check_customer->fields['customers_id'], 'integer');    
  42      $db->Execute($sql);
  43  
  44      $html_msg['EMAIL_CUSTOMERS_NAME'] = $check_customer->fields['customers_firstname'] . ' ' . $check_customer->fields['customers_lastname'];
  45      $html_msg['EMAIL_MESSAGE_HTML'] = sprintf(EMAIL_PASSWORD_REMINDER_BODY, $new_password);
  46  
  47      // send the email

  48      zen_mail($check_customer->fields['customers_firstname'] . ' ' . $check_customer->fields['customers_lastname'], $email_address, EMAIL_PASSWORD_REMINDER_SUBJECT, sprintf(EMAIL_PASSWORD_REMINDER_BODY, $new_password), STORE_NAME, EMAIL_FROM, $html_msg,'password_forgotten');
  49  
  50      $messageStack->add_session('login', SUCCESS_PASSWORD_SENT, 'success');
  51  
  52      zen_redirect(zen_href_link(FILENAME_LOGIN, '', 'SSL'));
  53    } else {
  54      $messageStack->add('password_forgotten', TEXT_NO_EMAIL_ADDRESS_FOUND);
  55    }
  56  }
  57  
  58  $breadcrumb->add(NAVBAR_TITLE_1, zen_href_link(FILENAME_LOGIN, '', 'SSL'));
  59  $breadcrumb->add(NAVBAR_TITLE_2);
  60  
  61  // This should be last line of the script:

  62  $zco_notifier->notify('NOTIFY_HEADER_END_PASSWORD_FORGOTTEN');
  63  ?>


Généré le : Mon Nov 26 16:45:43 2007 par Balluche grâce à PHPXref 0.7
  Clicky Web Analytics