[ Index ] |
|
Code source de Zen Cart E-Commerce Shopping Cart 1.3.7.1 |
1 <?php 2 /** 3 * Login Page 4 * 5 * @package page 6 * @copyright Copyright 2003-2007 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 6528 2007-06-25 23:25:27Z drbyte $ 10 */ 11 12 // This should be first line of the script: 13 $zco_notifier->notify('NOTIFY_HEADER_START_LOGIN'); 14 15 // redirect the customer to a friendly cookie-must-be-enabled page if cookies are disabled (or the session has not started) 16 if ($session_started == false) { 17 zen_redirect(zen_href_link(FILENAME_COOKIE_USAGE)); 18 } 19 20 // if the customer is logged in already, redirect them to the My account page 21 if (isset($_SESSION['customer_id']) and $_SESSION['customer_id'] != '') { 22 zen_redirect(zen_href_link(FILENAME_ACCOUNT, '', 'SSL')); 23 } 24 25 require(DIR_WS_MODULES . zen_get_module_directory('require_languages.php')); 26 include(DIR_WS_MODULES . zen_get_module_directory(FILENAME_CREATE_ACCOUNT)); 27 28 $error = false; 29 if (isset($_GET['action']) && ($_GET['action'] == 'process')) { 30 $email_address = zen_db_prepare_input($_POST['email_address']); 31 $password = zen_db_prepare_input($_POST['password']); 32 33 /* Privacy-policy-read does not need to be checked during "login" 34 if (DISPLAY_PRIVACY_CONDITIONS == 'true') { 35 if (!isset($_POST['privacy_conditions']) || ($_POST['privacy_conditions'] != '1')) { 36 $error = true; 37 $messageStack->add('create_account', ERROR_PRIVACY_STATEMENT_NOT_ACCEPTED, 'error'); 38 } 39 } 40 */ 41 42 43 // Check if email exists 44 $check_customer_query = "SELECT customers_id, customers_firstname, customers_password, 45 customers_email_address, customers_default_address_id, 46 customers_authorization, customers_referral 47 FROM " . TABLE_CUSTOMERS . " 48 WHERE customers_email_address = :email"; 49 50 $check_customer_query =$db->bindVars($check_customer_query, ':email', $email_address, 'string'); 51 $check_customer = $db->Execute($check_customer_query); 52 53 if (!$check_customer->RecordCount()) { 54 $error = true; 55 } else { 56 // Check that password is good 57 if (!zen_validate_password($password, $check_customer->fields['customers_password'])) { 58 $error = true; 59 } else { 60 if (SESSION_RECREATE == 'True') { 61 zen_session_recreate(); 62 } 63 64 $check_country_query = "SELECT entry_country_id, entry_zone_id 65 FROM " . TABLE_ADDRESS_BOOK . " 66 WHERE customers_id = :customersID 67 AND address_book_id = :adressBookID"; 68 69 $check_country_query = $db->bindVars($check_country_query, ':customersID', $check_customer->fields['customers_id'], 'integer'); 70 $check_country_query = $db->bindVars($check_country_query, ':adressBookID', $check_customer->fields['customers_default_address_id'], 'integer'); 71 $check_country = $db->Execute($check_country_query); 72 73 $_SESSION['customer_id'] = $check_customer->fields['customers_id']; 74 $_SESSION['customer_default_address_id'] = $check_customer->fields['customers_default_address_id']; 75 $_SESSION['customers_authorization'] = $check_customer->fields['customers_authorization']; 76 $_SESSION['customer_first_name'] = $check_customer->fields['customers_firstname']; 77 $_SESSION['customer_country_id'] = $check_country->fields['entry_country_id']; 78 $_SESSION['customer_zone_id'] = $check_country->fields['entry_zone_id']; 79 80 $sql = "UPDATE " . TABLE_CUSTOMERS_INFO . " 81 SET customers_info_date_of_last_logon = now(), 82 customers_info_number_of_logons = customers_info_number_of_logons+1 83 WHERE customers_info_id = :customersID"; 84 85 $sql = $db->bindVars($sql, ':customersID', $_SESSION['customer_id'], 'integer'); 86 $db->Execute($sql); 87 $zco_notifier->notify('NOTIFY_LOGIN_SUCCESS'); 88 89 // restore cart contents 90 $_SESSION['cart']->restore_contents(); 91 /* 92 if ($_SESSION['cart']->count_contents() > 0) { 93 zen_redirect(zen_href_link(FILENAME_CHECKOUT_SHIPPING)); 94 } 95 */ 96 if (sizeof($_SESSION['navigation']->snapshot) > 0) { 97 // $back = sizeof($_SESSION['navigation']->path)-2; 98 //if (isset($_SESSION['navigation']->path[$back]['page'])) { 99 // if (sizeof($_SESSION['navigation']->path)-2 > 0) { 100 $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']); 101 // $origin_href = zen_back_link_only(true); 102 $_SESSION['navigation']->clear_snapshot(); 103 zen_redirect($origin_href); 104 } else { 105 zen_redirect(zen_href_link(FILENAME_DEFAULT)); 106 } 107 } 108 } 109 } 110 111 if ($error == true) { 112 $messageStack->add('login', TEXT_LOGIN_ERROR); 113 $zco_notifier->notify('NOTIFY_LOGIN_FAILURE'); 114 } 115 116 $breadcrumb->add(NAVBAR_TITLE); 117 118 // Check for PayPal express checkout button suitability: 119 $paypalec_enabled = (defined('MODULE_PAYMENT_PAYPALWPP_STATUS') && MODULE_PAYMENT_PAYPALWPP_STATUS == 'True'); 120 // Check for express checkout button suitability: 121 $ec_button_enabled = ($paypalec_enabled && ($_SESSION['cart']->count_contents() > 0 && $_SESSION['cart']->total > 0)); 122 123 124 // This should be last line of the script: 125 $zco_notifier->notify('NOTIFY_HEADER_END_LOGIN'); 126 ?>
titre
Description
Corps
titre
Description
Corps
titre
Description
Corps
titre
Corps
Généré le : Mon Nov 26 16:45:43 2007 | par Balluche grâce à PHPXref 0.7 |
![]() |