Example #1
0
function tep_doautologin()
{
    global $HTTP_COOKIE_VARS, $cart, $cart_cs, $cart_fv, $cart_pr, $customer_id, $customer_default_address_id, $customer_first_name, $customer_country_id, $customer_zone_id;
    global $navigation;
    if (isset($HTTP_COOKIE_VARS['osC_AutoCookieLogin'])) {
        $ip_address = tep_get_ip_address();
        $check_customer_query = tep_db_query("select customers_id, customers_firstname, customers_lastname, customers_password, customers_email_address, customers_default_address_id from " . TABLE_CUSTOMERS . " where md5(CONCAT(customers_id,customers_email_address,customers_password,'" . $ip_address . "'))= '" . $HTTP_COOKIE_VARS['osC_AutoCookieLogin'] . "'");
        if (tep_db_num_rows($check_customer_query)) {
            $check_customer = tep_db_fetch_array($check_customer_query);
            if (SESSION_RECREATE == 'True') {
                tep_session_recreate();
            }
            $check_country_query = tep_db_query("select entry_country_id, entry_zone_id from " . TABLE_ADDRESS_BOOK . " where customers_id = '" . $check_customer['customers_id'] . "' and address_book_id = '" . (int) $check_customer['customers_default_address_id'] . "'");
            $check_country = tep_db_fetch_array($check_country_query);
            $customer_id = $check_customer['customers_id'];
            $customer_default_address_id = $check_customer['customers_default_address_id'];
            $customer_first_name = $check_customer['customers_firstname'];
            $customer_country_id = $check_country['entry_country_id'];
            $customer_zone_id = $check_country['entry_zone_id'];
            if (!tep_session_is_registered('customer_id')) {
                tep_session_register('customer_id');
            }
            if (!tep_session_is_registered('customer_default_address_id')) {
                tep_session_register('customer_default_address_id');
            }
            if (!tep_session_is_registered('customer_first_name')) {
                tep_session_register('customer_first_name');
            }
            if (!tep_session_is_registered('customer_country_id')) {
                tep_session_register('customer_country_id');
            }
            if (!tep_session_is_registered('customer_zone_id')) {
                tep_session_register('customer_zone_id');
            }
            tep_autologincookie(true);
            // Save cookie
            tep_db_query("update " . TABLE_CUSTOMERS_INFO . " set customers_info_date_of_last_logon = now(), customers_info_number_of_logons = customers_info_number_of_logons+1 where customers_info_id = '" . (int) $customer_id . "'");
            $cart->restore_contents();
            // restore cart contents
            $cart_cs->restore_contents();
            $cart_fv->restore_contents();
            $cart_pr->restore_contents();
            if (sizeof($navigation->snapshot) > 0) {
                $origin_href = tep_href_link($navigation->snapshot['page'], tep_array_to_string($navigation->snapshot['get'], array(tep_session_name())), $navigation->snapshot['mode']);
                $navigation->clear_snapshot();
                tep_redirect($origin_href);
            } else {
                //			    tep_redirect(tep_href_link(FILENAME_DEFAULT));
                tep_redirect(substr(tep_href_link(getenv('REQUEST_URI')), strlen(HTTP_SERVER . DIR_WS_HTTP_CATALOG)));
            }
        }
    }
}
Example #2
0
 $customer_default_address_id = $check_customer['customers_default_address_id'];
 $customer_first_name = $check_customer['customers_firstname'];
 $customer_country_id = $check_country['entry_country_id'];
 $customer_zone_id = $check_country['entry_zone_id'];
 $customer_qtpro = $check_customer['qtpro'];
 tep_session_register('customer_id');
 tep_session_register('customer_default_address_id');
 tep_session_register('customer_first_name');
 tep_session_register('customer_country_id');
 tep_session_register('customer_zone_id');
 tep_session_register('customer_qtpro');
 if (ALLOW_AUTOLOGONLOGON == 'false' || $HTTP_POST_VARS['remember_me'] == '') {
     //tep_autologincookie(false);
     tep_autologincookie(true);
 } else {
     tep_autologincookie(true);
 }
 tep_db_query("update " . TABLE_CUSTOMERS_INFO . " set customers_info_date_of_last_logon = now(), customers_info_number_of_logons = customers_info_number_of_logons+1 where customers_info_id = '" . (int) $customer_id . "'");
 // restore cart contents
 $cart->restore_contents();
 $cart_cs->restore_contents();
 $cart_fv->restore_contents();
 $cart_pr->restore_contents();
 if (sizeof($navigation->snapshot) > 0) {
     $origin_href = tep_href_link($navigation->snapshot['page'], tep_array_to_string($navigation->snapshot['get'], array(tep_session_name())), $navigation->snapshot['mode']);
     $navigation->clear_snapshot();
     //tep_redirect($origin_href);
 } else {
     //tep_redirect(tep_href_link(FILENAME_DEFAULT));
 }
 $response['type'] = 1;
Example #3
0
define('WARN_SESSION_DIRECTORY_NOT_WRITEABLE', 'true');
define('WARN_SESSION_AUTO_START', 'true');
define('WARN_DOWNLOAD_DIRECTORY_NOT_READABLE', 'true');
// #CHAVEIRO14# Autologon
require 'includes/functions/autologin.php';
if ($session_started == true) {
    if (ALLOW_AUTOLOGON == 'true') {
        // Is Autologon enabled?
        if (basename($PHP_SELF) != FILENAME_LOGIN) {
            // yes
            if (!tep_session_is_registered('customer_id')) {
                tep_doautologin();
            }
        }
    } else {
        tep_autologincookie(false);
    }
}
// #CHAVEIRO14# Autologon END
function curPageName2()
{
    return substr($_SERVER["SCRIPT_NAME"], strrpos($_SERVER["SCRIPT_NAME"], "/") + 1);
}
if (!in_array(basename($_SERVER['SCRIPT_FILENAME']), array("login.php", "logoff.php", "password_forgotten.php", "create_account.php", "create_account_demo.php", "sale_quotes_ajax.php", "create_account_success.php", "ipn.php", "product_info_window.php", "product_info_factory_user.php", "create_account_ajax.php", "get_country.php", "cya_ajax.php", "get_state.php"))) {
    if (!tep_session_is_registered('customer_id')) {
        if (curPageName2() != 'members.php' && curPageName2() != 'member_detail_m.php') {
            if ($navigation) {
                $navigation->set_snapshot('');
            }
            tep_redirect(tep_href_link(FILENAME_LOGIN, '', 'SSL'));
        }