[ 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/time_out/ -> header_php.php (source)

   1  <?php
   2  /**

   3   * Time out page

   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 3000 2006-02-09 21:11:37Z wilt $

  10   */
  11  
  12  require(DIR_WS_MODULES . zen_get_module_directory('require_languages.php'));
  13  $breadcrumb->add(NAVBAR_TITLE);
  14  
  15  
  16  $error = false;
  17  if (isset($_GET['action']) && ($_GET['action'] == 'process')) {
  18    $email_address = zen_db_prepare_input($_POST['email_address']);
  19    $password = zen_db_prepare_input($_POST['password']);
  20  
  21    /* Privacy-policy-read does not need to be checked during "login"

  22    if (DISPLAY_PRIVACY_CONDITIONS == 'true') {

  23    if (!isset($_POST['privacy_conditions']) || ($_POST['privacy_conditions'] != '1')) {

  24    $error = true;

  25    $messageStack->add('create_account', ERROR_PRIVACY_STATEMENT_NOT_ACCEPTED, 'error');

  26    }

  27    }

  28    */
  29  
  30    // Check if email exists

  31    $check_customer_query = "SELECT customers_id, customers_firstname, customers_password,
  32                                    customers_email_address, customers_default_address_id,
  33                                    customers_authorization, customers_referral
  34                             FROM " . TABLE_CUSTOMERS . "
  35                             WHERE customers_email_address = :emailAddress";
  36  
  37    $check_customer_query = $db->bindVars($check_customer_query, ':emailAddress', $email_address, 'string');
  38    $check_customer = $db->Execute($check_customer_query);
  39  
  40    if (!$check_customer->RecordCount()) {
  41      $error = true;
  42    } else {
  43      // Check that password is good

  44      if (!zen_validate_password($password, $check_customer->fields['customers_password'])) {
  45        $error = true;
  46      } else {
  47        if (SESSION_RECREATE == 'True') {
  48          zen_session_recreate();
  49        }
  50  
  51        $check_country_query = "SELECT entry_country_id, entry_zone_id
  52                                FROM " . TABLE_ADDRESS_BOOK . "
  53                                WHERE customers_id = :customersID
  54                                AND address_book_id = :addressBookID";
  55  
  56        $check_country_query = $db->bindVars($check_country_query, ':customersID', $check_customer->fields['customers_id'], 'integer');
  57        $check_country_query = $db->bindVars($check_country_query, ':addressBookID', $check_customer->fields['customers_default_address_id'], 'integer');
  58        $check_country = $db->Execute($check_country_query);
  59  
  60        $_SESSION['customer_id'] = $check_customer->fields['customers_id'];
  61        $_SESSION['customer_default_address_id'] = $check_customer->fields['customers_default_address_id'];
  62        $_SESSION['customers_authorization'] = $check_customer->fields['customers_authorization'];
  63        $_SESSION['customer_first_name'] = $check_customer->fields['customers_firstname'];
  64        $_SESSION['customer_country_id'] = $check_country->fields['entry_country_id'];
  65        $_SESSION['customer_zone_id'] = $check_country->fields['entry_zone_id'];
  66  
  67        $sql = "UPDATE " . TABLE_CUSTOMERS_INFO . "
  68                SET customers_info_date_of_last_logon = now(), customers_info_number_of_logons = customers_info_number_of_logons+1
  69                WHER customers_info_id = :customersID";
  70  
  71        $sqly = $db->bindVars($sql, ':customersID', $_SESSION['customer_id'], 'integer');
  72        $db->Execute($sql);
  73        $zco_notifier->notify('NOTIFY_LOGIN_SUCCESS');
  74  
  75        // restore cart contents

  76        $_SESSION['cart']->restore_contents();
  77        /*

  78        if ($_SESSION['cart']->count_contents() > 0) {

  79        zen_redirect(zen_href_link(FILENAME_CHECKOUT_SHIPPING));

  80        }

  81        */
  82        if (sizeof($_SESSION['navigation']->snapshot) > 0) {
  83          //    $back = sizeof($_SESSION['navigation']->path)-2;

  84          //if (isset($_SESSION['navigation']->path[$back]['page'])) {

  85          //    if (sizeof($_SESSION['navigation']->path)-2 > 0) {

  86          $origin_href = zen_href_link($_SESSION['navigation']->snapshot['page'], zen_array_to_string($_SESSION['navigation']->snapshot['get'], array(zen_session_name())), $_SESSION['navigation']->snapshot['mode']);
  87          //            $origin_href = zen_back_link_only(true);

  88          $_SESSION['navigation']->clear_snapshot();
  89          zen_redirect($origin_href);
  90        } else {
  91          zen_redirect(zen_href_link(FILENAME_DEFAULT));
  92        }
  93      }
  94    }
  95  }
  96  
  97  if ($error == true) {
  98    $messageStack->add('login', TEXT_LOGIN_ERROR);
  99    $zco_notifier->notify('NOTIFY_LOGIN_FAILURE');
 100  }
 101  ?>


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