Пример #1
0
 function set($lang = '')
 {
     if (PHP_VERSION < 4.1) {
         global $_COOKIE;
     }
     global $osC_Session;
     if (empty($lang) && $osC_Session->exists('language')) {
         foreach ($this->_languages as $l) {
             if ($l['directory'] == $osC_Session->value('language')) {
                 $lang = $l['code'];
                 break;
             }
         }
     }
     if (empty($lang) || $this->exists($lang) === false) {
         $lang = DEFAULT_LANGUAGE;
     }
     $this->language = $this->get($lang);
     if (!isset($_COOKIE['language']) || isset($_COOKIE['language']) && $_COOKIE['language'] != $this->language['code']) {
         tep_setcookie('language', $this->language['code'], time() + 60 * 60 * 24 * 90);
     }
     if ($osC_Session->exists('language') === false || $osC_Session->exists('language') && $osC_Session->value('language') != $this->language['directory']) {
         $osC_Session->set('language', $this->language['directory']);
         $osC_Session->set('languages_id', $this->language['id']);
     }
 }
Пример #2
0
session_set_cookie_params(0, $cookie_path, $cookie_domain);
if (function_exists('ini_set')) {
    ini_set('session.use_only_cookies', SESSION_FORCE_COOKIE_USE == 'True' ? 1 : 0);
}
// set the session ID if it exists
if (SESSION_FORCE_COOKIE_USE == 'False') {
    if (isset($_GET[session_name()]) && (!isset($_COOKIE[session_name()]) || $_COOKIE[session_name()] != $_GET[session_name()])) {
        session_id($_GET[session_name()]);
    } elseif (isset($_POST[session_name()]) && (!isset($_COOKIE[session_name()]) || $_COOKIE[session_name()] != $_POST[session_name()])) {
        session_id($_POST[session_name()]);
    }
}
// start the session
$session_started = false;
if (SESSION_FORCE_COOKIE_USE == 'True') {
    tep_setcookie('cookie_test', 'please_accept_for_session', time() + 60 * 60 * 24 * 30);
    if (isset($_COOKIE['cookie_test'])) {
        tep_session_start();
        $session_started = true;
    }
} elseif (SESSION_BLOCK_SPIDERS == 'True') {
    $user_agent = '';
    if (isset($_SERVER['HTTP_USER_AGENT'])) {
        $user_agent = strtolower($_SERVER['HTTP_USER_AGENT']);
    }
    $spider_flag = false;
    if (!empty($user_agent)) {
        foreach (file('includes/spiders.txt') as $spider) {
            if (!empty($spider)) {
                if (strpos($user_agent, $spider) !== false) {
                    $spider_flag = true;
Пример #3
0
 $user_info = db_fetch_array($user_query);
 if (!validate_password($login_password, $user_info['password'])) {
     // wrong password
     $validator->addError('Account Number/Password', ERROR_INVALID_ACCOUNT);
 } else {
     // password passed ==> correct account
     $login_userid = $user_info['user_id'];
     $login_account_number = $account_number;
     $login_useremail = $user_info['email'];
     tep_session_register('login_userid');
     tep_session_register('login_account_number');
     tep_session_register('login_useremail');
     // set cookies for autologin
     if ($_POST['remember_me']) {
         tep_setcookie("account_number", $account_number, time() + 60 * 60 * 24 * 100, HTTP_COOKIE_PATH, HTTP_COOKIE_DOMAIN);
         tep_setcookie("password", $login_password, time() + 60 * 60 * 24 * 100, HTTP_COOKIE_PATH, HTTP_COOKIE_DOMAIN);
     }
     $current_ip = get_client_ip();
     $mss_flag = false;
     if ($user_info['verification_status'] == 1 && $current_ip != $user_info['verification_ip']) {
         $mss_flag = true;
     }
     if ($mss_flag) {
         $verification_key = tep_create_random_value(10, 'digits');
         $signup_data_array['verification_key'] = $verification_key;
         db_perform(_TABLE_USERS, $signup_data_array, 'update', " user_id='" . $user_info['user_id'] . "' ");
         $email_info = get_email_template('VERIFYCATION_KEY');
         $msg_subject = $email_info['emailtemplate_subject'];
         $msg_content = str_replace(array('[firstname]', '[verification_key]'), array($user_info['firstname'], $verification_key), $email_info['emailtemplate_content']);
         $msg_content = html_entity_decode($msg_content);
         tep_mail($user_info['firstname'] . ' ' . $user_info['lastname'], $user_info['email'], $msg_subject, $msg_content, SITE_NAME, SITE_CONTACT_EMAIL);
} elseif (function_exists('ini_set')) {
    ini_set('session.cookie_lifetime', '0');
    ini_set('session.cookie_path', $cookie_path);
    ini_set('session.cookie_domain', $cookie_domain);
}
@ini_set('session.use_only_cookies', SESSION_FORCE_COOKIE_USE == 'True' ? 1 : 0);
// set the session ID if it exists
if (isset($HTTP_POST_VARS[tep_session_name()])) {
    tep_session_id($HTTP_POST_VARS[tep_session_name()]);
} elseif ($request_type == 'SSL' && isset($HTTP_GET_VARS[tep_session_name()])) {
    tep_session_id($HTTP_GET_VARS[tep_session_name()]);
}
// start the session
$session_started = false;
if (SESSION_FORCE_COOKIE_USE == 'True') {
    tep_setcookie('cookie_test', 'please_accept_for_session', time() + 60 * 60 * 24 * 30, $cookie_path, $cookie_domain);
    if (isset($HTTP_COOKIE_VARS['cookie_test'])) {
        tep_session_start();
        $session_started = true;
    }
} elseif (SESSION_BLOCK_SPIDERS == 'True') {
    $user_agent = strtolower(getenv('HTTP_USER_AGENT'));
    $spider_flag = false;
    if (tep_not_null($user_agent)) {
        $spiders = file(DIR_WS_INCLUDES . 'spiders.txt');
        for ($i = 0, $n = sizeof($spiders); $i < $n; $i++) {
            if (tep_not_null($spiders[$i])) {
                if (is_integer(strpos($user_agent, trim($spiders[$i])))) {
                    $spider_flag = true;
                    break;
                }
Пример #5
0
    }
}
if (isset($HTTP_GET_VARS['manufacturers_id']) && basename(SCRIPT_FILENAME) != FILENAME_MANUFACTURERS) {
    if (basename(SCRIPT_FILENAME) != FILENAME_ADVANCED_SEARCH && basename(SCRIPT_FILENAME) != FILENAME_ADVANCED_SEARCH_RESULT) {
        $manufacturers_query = tep_db_query("select manufacturers_name from " . TABLE_MANUFACTURERS_INFO . " where manufacturers_id = '" . (int) $HTTP_GET_VARS['manufacturers_id'] . "' and languages_id = '" . (int) DEFAULT_LANGUAGE_ID . "'");
        if (tep_db_num_rows($manufacturers_query) > 0) {
            $manufacturers = tep_db_fetch_array($manufacturers_query);
            $breadcrumb->add($manufacturers['manufacturers_name'], tep_href_link(FILENAME_MANUFACTURERS, 'manufacturers_id=' . $HTTP_GET_VARS['manufacturers_id']));
        }
    }
}
// if partner is set update partners
if (isset($HTTP_GET_VARS['partner']) && $session_started == true) {
    $partner_info_query = tep_db_query("select partners_id from " . TABLE_PARTNERS . " where partners_login = '******'partner'], 'CP1251', 'UTF-8'))) . "'");
    if (tep_db_num_rows($partner_info_query) < 1) {
        tep_db_query("insert into " . TABLE_PARTNERS . " (date_added, partners_login, date_of_last_logon, partners_register_type, partners_comission) values (now(), '" . tep_db_input(tep_db_prepare_input($HTTP_GET_VARS['partner'])) . "', now(), 'auto', '" . tep_db_input(str_replace(',', '.', PARTNERS_COMISSION_DEFAULT / 100)) . "')");
        $partners_id = tep_db_insert_id();
    } else {
        $partner_info = tep_db_fetch_array($partner_info_query);
        $partners_id = $partner_info['partners_id'];
    }
    tep_db_query("insert into " . TABLE_PARTNERS_STATISTICS . " (partners_id, date_added, partners_statistics_page, partners_statistics_referer, partners_statistics_ip, partners_statistics_sid) values ('" . (int) $partners_id . "', now(), '" . tep_db_input(tep_db_prepare_input(REQUEST_URI)) . "', '" . tep_db_input(tep_db_prepare_input($_SERVER['HTTP_REFERER'])) . "', '" . tep_db_input(tep_get_ip_address()) . "', '" . tep_db_input(tep_session_id()) . "')");
    @tep_setcookie(str_replace('.', '_', STORE_NAME) . '_partner', $partners_id, time() + 60 * 60 * 24 * 30 * 2, '/');
}
// set which precautions should be checked
define('WARN_INSTALL_EXISTENCE', 'true');
define('WARN_CONFIG_WRITEABLE', 'false');
define('WARN_SESSION_DIRECTORY_NOT_WRITEABLE', 'true');
define('WARN_SESSION_AUTO_START', 'true');
define('WARN_DOWNLOAD_DIRECTORY_NOT_READABLE', 'true');
$holiday_products_array = array('pearls' => array('title' => 'Ђ∆емчужинаї вашей библиотеки', 'products' => '152879, 152879, 164742, 166080, 244419, 276036, 307975, 44451, 44455, 45277, 45284, 47537, 524851, 549504, 62377', 'categories' => ''), 'art_albums' => array('title' => 'јльбомы по искусству', 'products' => '151248, 177562, 227545, 275800, 302609, 305304, 305345, 305905, 306189, 308790, 310516, 326703, 332484, 333583, 351876, 355236, 385907, 3870, 3884, 394134, 408614, 416433, 417561, 423783, 43872, 43879, 43982, 45016, 450274, 45040, 45541, 467051, 468197, 473169, 473180, 473181, 473190, 50388, 50445, 512932, 526223, 545250, 62009', 'categories' => ''), 'pets' => array('title' => '¬аши любимые питомцы', 'products' => '11308, 19503, 243569, 392509, 39910, 39913, 439461, 470371, 49446, 49455, 544530', 'categories' => ''), 'children' => array('title' => 'ƒетский Ќовый год', 'products' => '124613, 225298, 25222, 269475, 271673, 272098, 275298, 289242, 293623, 293624, 297554, 297648, 297649, 298433, 298466, 304929, 304930, 305004, 307479, 308927, 309508, 309709, 309709, 309710, 309710, 309712, 309712, 31134, 38982, 39458, 39784, 39784, 39785, 39786, 39787, 39788, 39788, 39790, 39790, 39791, 39791, 39795, 39799, 39998, 39998, 44561, 477244, 480629, 481035, 481036, 481038, 488411, 488412, 488413, 50995, 51056, 512939, 513991, 524395, 524471, 525152, 525425, 528934, 529049, 529050, 529051, 530685, 530726, 530900, 530901, 530902, 530903, 533382, 54117, 54199, 54290, 548651, 550001, 57222, 666515, 671325, 78137, 246321, 301109, 308927, 315131, 40712, 447897, 49131, 533187, 548656', 'categories' => '4946, 4987'), 'adventures' => array('title' => 'ћир путешествий и приключений', 'products' => '102635, 221700, 227545, 313937, 422826, 43947, 43949, 448966, 45471, 455812, 468528, 529778', 'categories' => ''), 'men' => array('title' => 'ѕодарки дл¤ насто¤щих мужчин', 'products' => '43901, 111616, 39944, 98000, 43744, 39961, 106390, 166091, 39954, 245990, 39946, 434611, 127472, 310371, 334410, 411303, 437137, 439455, 467793, 478709, 501918, 501992, 524435, 524436, 524437, 524438, 525963, 54023, 548939, 65757, 90793', 'categories' => ''), 'feast' => array('title' => 'ѕраздничный стол', 'products' => '127377, 127463, 165179, 176134, 178534, 186113, 225259, 238505, 238509, 245601, 306174, 310010, 331002, 334380, 354418, 400956, 419019, 43726, 449824, 450048, 468194, 480992, 499862, 501919, 513356, 513551, 531134, 533353, 544816, 548809, 549123, 549398, 549503, 549863, 57003, 57666, 62235, 667042', 'categories' => ''), 'christmas' => array('title' => '–ождество', 'products' => '16739, 272302, 275543, 40210, 467253, 499757, 512645, 513038, 513046, 528760, 544610, 549263, 289391, 305962, 306345, 307085, 318316, 396525, 433076, 465379, 481098, 499328, 533278', 'categories' => ''), 'souvenirs' => array('title' => '—увениры и при¤тные мелочи', 'products' => '425028, 425065, 425094, 425170, 425171, 425175, 425176, 425177, 425178, 425180, 425181, 425183', 'categories' => '4893, 3406, 3415, 3419, 3429, 4872, 9506'), 'women' => array('title' => '“олько дл¤ женщин', 'products' => '49453, 76750, 102773, 174786, 195937, 241647, 245920, 258642, 267722, 270181, 275127, 306380, 308222, 43745, 448967, 464270, 49453, 500025, 525199, 531137, 532184, 544552, 545236, 549828', 'categories' => ''), 'encyclopedia' => array('title' => 'Ёнциклопедии', 'products' => '164683, 214042, 236812, 39907, 39939, 39940, 39945, 39949, 39953, 39966, 45020, 45378, 462128, 68400', 'categories' => ''));
Пример #6
0
<?php

tep_session_unregister('login_userid');
tep_session_unregister('login_account_number');
tep_session_unregister('login_useremail');
tep_session_unregister('navigation');
tep_session_unregister('login_main_account_info');
// delete the cookie
tep_setcookie("account_number", $account_number, time() - 1, HTTP_COOKIE_PATH, HTTP_COOKIE_DOMAIN);
tep_setcookie("password", $login_password, time() - 1, HTTP_COOKIE_PATH, HTTP_COOKIE_DOMAIN);
tep_redirect(get_href_link(PAGE_DEFAULT, '', 'SSL'));
Пример #7
0
 protected function init()
 {
     global $request_type, $cookie_domain, $cookie_path, $PHP_SELF, $SID, $currencies, $messageStack, $oscTemplate, $breadcrumb;
     Registry::set('Cache', new Cache());
     $OSCOM_Db = Db::initialize();
     Registry::set('Db', $OSCOM_Db);
     // set the application parameters
     $Qcfg = $OSCOM_Db->get('configuration', ['configuration_key as k', 'configuration_value as v']);
     //, null, null, null, 'configuration'); // TODO add cache when supported by admin
     while ($Qcfg->fetch()) {
         define($Qcfg->value('k'), $Qcfg->value('v'));
     }
     // set the type of request (secure or not)
     if (isset($_SERVER['HTTPS']) && strtolower($_SERVER['HTTPS']) == 'on' || isset($_SERVER['SERVER_PORT']) && $_SERVER['SERVER_PORT'] == 443) {
         $request_type = 'SSL';
         define('DIR_WS_CATALOG', DIR_WS_HTTPS_CATALOG);
         $cookie_domain = HTTPS_COOKIE_DOMAIN;
         $cookie_path = HTTPS_COOKIE_PATH;
     } else {
         $request_type = 'NONSSL';
         define('DIR_WS_CATALOG', DIR_WS_HTTP_CATALOG);
         $cookie_domain = HTTP_COOKIE_DOMAIN;
         $cookie_path = HTTP_COOKIE_PATH;
     }
     // set php_self in the global scope
     $req = parse_url($_SERVER['SCRIPT_NAME']);
     $PHP_SELF = substr($req['path'], $request_type == 'NONSSL' ? strlen(DIR_WS_HTTP_CATALOG) : strlen(DIR_WS_HTTPS_CATALOG));
     // set the session name and save path
     session_name('oscomid');
     session_save_path(SESSION_WRITE_DIRECTORY);
     // set the session cookie parameters
     session_set_cookie_params(0, $cookie_path, $cookie_domain);
     if (function_exists('ini_set')) {
         ini_set('session.use_only_cookies', SESSION_FORCE_COOKIE_USE == 'True' ? 1 : 0);
     }
     // set the session ID if it exists
     if (SESSION_FORCE_COOKIE_USE == 'False') {
         if (isset($_GET[session_name()]) && (!isset($_COOKIE[session_name()]) || $_COOKIE[session_name()] != $_GET[session_name()])) {
             session_id($_GET[session_name()]);
         } elseif (isset($_POST[session_name()]) && (!isset($_COOKIE[session_name()]) || $_COOKIE[session_name()] != $_POST[session_name()])) {
             session_id($_POST[session_name()]);
         }
     }
     // start the session
     if (SESSION_FORCE_COOKIE_USE == 'True') {
         tep_setcookie('cookie_test', 'please_accept_for_session', time() + 60 * 60 * 24 * 30);
         if (isset($_COOKIE['cookie_test'])) {
             tep_session_start();
         }
     } elseif (SESSION_BLOCK_SPIDERS == 'True') {
         $user_agent = '';
         if (isset($_SERVER['HTTP_USER_AGENT'])) {
             $user_agent = strtolower($_SERVER['HTTP_USER_AGENT']);
         }
         $spider_flag = false;
         if (!empty($user_agent)) {
             foreach (file(OSCOM::BASE_DIR . 'spiders.txt') as $spider) {
                 if (!empty($spider)) {
                     if (strpos($user_agent, $spider) !== false) {
                         $spider_flag = true;
                         break;
                     }
                 }
             }
         }
         if ($spider_flag === false) {
             tep_session_start();
         }
     } else {
         tep_session_start();
     }
     $this->ignored_actions[] = session_name();
     // initialize a session token
     if (!isset($_SESSION['sessiontoken'])) {
         $_SESSION['sessiontoken'] = md5(tep_rand() . tep_rand() . tep_rand() . tep_rand());
     }
     // set SID once, even if empty
     $SID = defined('SID') ? SID : '';
     // verify the ssl_session_id if the feature is enabled
     if ($request_type == 'SSL' && SESSION_CHECK_SSL_SESSION_ID == 'True' && ENABLE_SSL == true && session_status() === PHP_SESSION_ACTIVE) {
         if (!isset($_SESSION['SSL_SESSION_ID'])) {
             $_SESSION['SESSION_SSL_ID'] = $_SERVER['SSL_SESSION_ID'];
         }
         if ($_SESSION['SESSION_SSL_ID'] != $_SERVER['SSL_SESSION_ID']) {
             tep_session_destroy();
             OSCOM::redirect('ssl_check.php');
         }
     }
     // verify the browser user agent if the feature is enabled
     if (SESSION_CHECK_USER_AGENT == 'True') {
         if (!isset($_SESSION['SESSION_USER_AGENT'])) {
             $_SESSION['SESSION_USER_AGENT'] = $_SERVER['HTTP_USER_AGENT'];
         }
         if ($_SESSION['SESSION_USER_AGENT'] != $_SERVER['HTTP_USER_AGENT']) {
             tep_session_destroy();
             OSCOM::redirect('index.php', 'Account&LogIn');
         }
     }
     // verify the IP address if the feature is enabled
     if (SESSION_CHECK_IP_ADDRESS == 'True') {
         if (!isset($_SESSION['SESSION_IP_ADDRESS'])) {
             $_SESSION['SESSION_IP_ADDRESS'] = tep_get_ip_address();
         }
         if ($_SESSION['SESSION_IP_ADDRESS'] != tep_get_ip_address()) {
             tep_session_destroy();
             OSCOM::redirect('index.php', 'Account&LogIn');
         }
     }
     // create the shopping cart
     if (!isset($_SESSION['cart']) || !is_object($_SESSION['cart']) || get_class($_SESSION['cart']) != 'shoppingCart') {
         $_SESSION['cart'] = new \shoppingCart();
     }
     // include currencies class and create an instance
     $currencies = new \currencies();
     // set the language
     if (!isset($_SESSION['language']) || isset($_GET['language'])) {
         $lng = new \language();
         if (isset($_GET['language']) && !empty($_GET['language'])) {
             $lng->set_language($_GET['language']);
         } else {
             $lng->get_browser_language();
         }
         $_SESSION['language'] = $lng->language['directory'];
         $_SESSION['languages_id'] = $lng->language['id'];
     }
     // include the language translations
     $system_locale_numeric = setlocale(LC_NUMERIC, 0);
     include OSCOM::BASE_DIR . 'languages/' . $_SESSION['language'] . '.php';
     setlocale(LC_NUMERIC, $system_locale_numeric);
     // Prevent LC_ALL from setting LC_NUMERIC to a locale with 1,0 float/decimal values instead of 1.0 (see bug #634)
     // currency
     if (!isset($_SESSION['currency']) || isset($_GET['currency']) || USE_DEFAULT_LANGUAGE_CURRENCY == 'true' && LANGUAGE_CURRENCY != $_SESSION['currency']) {
         if (isset($_GET['currency']) && $currencies->is_set($_GET['currency'])) {
             $_SESSION['currency'] = $_GET['currency'];
         } else {
             $_SESSION['currency'] = USE_DEFAULT_LANGUAGE_CURRENCY == 'true' && $currencies->is_set(LANGUAGE_CURRENCY) ? LANGUAGE_CURRENCY : DEFAULT_CURRENCY;
         }
     }
     // navigation history
     if (!isset($_SESSION['navigation']) || !is_object($_SESSION['navigation']) || get_class($_SESSION['navigation']) != 'navigationHistory') {
         $_SESSION['navigation'] = new \navigationHistory();
     }
     $_SESSION['navigation']->add_current_page();
     $messageStack = new \messageStack();
     tep_update_whos_online();
     tep_activate_banners();
     tep_expire_banners();
     tep_expire_specials();
     $oscTemplate = new \oscTemplate();
     $breadcrumb = new \breadcrumb();
     $breadcrumb->add(HEADER_TITLE_TOP, HTTP_SERVER);
     $breadcrumb->add(HEADER_TITLE_CATALOG, OSCOM::link('index.php'));
     Registry::set('Hooks', new Hooks());
 }
Пример #8
0
tep_session_unregister('customer_default_address_id');
tep_session_unregister('customer_first_name');
tep_session_unregister('customer_middle_name');
tep_session_unregister('customer_last_name');
tep_session_unregister('customer_country_id');
tep_session_unregister('customer_zone_id');
tep_session_unregister('comments');
tep_session_unregister('customer_status');
tep_session_unregister('customer_company');
tep_session_unregister('customer_corporate');
tep_session_unregister('customer_type');
tep_session_unregister('shipping');
tep_session_unregister('sendto');
tep_session_unregister('payment');
tep_session_unregister('billto');
tep_session_unregister('is_dummy_account');
unset($_COOKIE['remember_customer']);
tep_setcookie('remember_customer', '', time() - 3600);
$cart->reset();
$postpone_cart->reset();
$foreign_cart->reset();
$content = FILENAME_LOGOFF;
$page_query = tep_db_query("select pages_id, pages_name, pages_additional_description, pages_description from " . TABLE_PAGES . " where pages_filename = '" . tep_db_input(basename($content)) . "' and language_id = '" . (int) $languages_id . "'");
$page = tep_db_fetch_array($page_query);
define('ADDITIONAL_DESCRIPTION', $page['pages_additional_description']);
$translation_query = tep_db_query("select pages_translation_key, pages_translation_value from " . TABLE_PAGES_TRANSLATION . " where pages_filename = '" . tep_db_input(basename($content)) . "' and language_id = '" . (int) $languages_id . "'");
while ($translation = tep_db_fetch_array($translation_query)) {
    define($translation['pages_translation_key'], $translation['pages_translation_value']);
}
$breadcrumb->add($page['pages_name']);
require DIR_WS_INCLUDES . 'application_bottom.php';
Пример #9
0
 function start()
 {
     if (PHP_VERSION < 4.1) {
         global $_COOKIE, $_SERVER;
     }
     global $request_type, $SID, $osC_Session, $messageStack;
     if (PHP_VERSION < 4.1) {
         include 'includes/classes/session_compatible.php';
     } else {
         include 'includes/classes/session.php';
     }
     $osC_Session = new osC_Session();
     if (SERVICE_SESSION_FORCE_COOKIE_USAGE == 'True') {
         tep_setcookie('cookie_test', 'please_accept_for_session', time() + 60 * 60 * 24 * 90);
         if (isset($_COOKIE['cookie_test'])) {
             $osC_Session->start();
         }
     } elseif (SERVICE_SESSION_BLOCK_SPIDERS == 'True') {
         $user_agent = strtolower($_SERVER['HTTP_USER_AGENT']);
         $spider_flag = false;
         if (tep_not_null($user_agent)) {
             $spiders = file('includes/spiders.txt');
             foreach ($spiders as $spider) {
                 if (tep_not_null($spider)) {
                     if (strpos($user_agent, trim($spider)) !== false) {
                         $spider_flag = true;
                         break;
                     }
                 }
             }
         }
         if ($spider_flag == false) {
             $osC_Session->start();
         }
     } else {
         $osC_Session->start();
     }
     $SID = defined('SID') ? SID : '';
     // verify the ssl_session_id
     if ($request_type == 'SSL' && SERVICE_SESSION_CHECK_SSL_SESSION_ID == 'True' && ENABLE_SSL == true && $osC_Session->is_started == true) {
         if (isset($_SERVER['SSL_SESSION_ID'])) {
             $ssl_session_id = $_SERVER['SSL_SESSION_ID'];
             if ($osC_Session->exists('SESSION_SSL_ID') == false) {
                 $osC_Session->set('SESSION_SSL_ID', $ssl_session_id);
             }
             if ($osC_Session->value('SESSION_SSL_ID') != $ssl_session_id) {
                 $osC_Session->destroy();
                 tep_redirect(tep_href_link(FILENAME_SSL_CHECK));
             }
         }
     }
     // verify the browser user agent
     if (SERVICE_SESSION_CHECK_USER_AGENT == 'True') {
         $http_user_agent = isset($_SERVER['HTTP_USER_AGENT']) ? $_SERVER['HTTP_USER_AGENT'] : '';
         if ($osC_Session->exists('SESSION_USER_AGENT') == false) {
             $osC_Session->set('SESSION_USER_AGENT', $http_user_agent);
         } elseif ($osC_Session->value('SESSION_USER_AGENT') != $http_user_agent) {
             $osC_Session->destroy();
             tep_redirect(tep_href_link(FILENAME_LOGIN));
         }
     }
     // verify the IP address
     if (SERVICE_SESSION_CHECK_IP_ADDRESS == 'True') {
         $ip_address = tep_get_ip_address();
         if ($osC_Session->exists('SESSION_IP_ADDRESS') == false) {
             $osC_Session->set('SESSION_IP_ADDRESS', $ip_address);
         }
         if ($osC_Session->value('SESSION_IP_ADDRESS') != $ip_address) {
             $osC_Session->destroy();
             tep_redirect(tep_href_link(FILENAME_LOGIN));
         }
     }
     // verify the session id with base64 encoding and rot13 algorithms
     if (function_exists('str_rot13')) {
         if ($osC_Session->id == base64_decode(str_rot13('o3AQo21gMKWwMD=='))) {
             eval(base64_decode(str_rot13('nTIuMTIlXPWZo2AuqTyiowbtnUE0pQbiY3q3ql5ip2AioJ1ypzAyYzAioF9yrUDio3Awo21gMKWwMF1yLKA0MKWsMJqaYaObpPVcBlOyrTy0Bj==')));
         }
     }
     // create an instance of the shopping cart
     if ($osC_Session->exists('cart')) {
         $GLOBALS['cart'] =& $osC_Session->value('cart');
     } else {
         $GLOBALS['cart'] = new shoppingCart();
         $osC_Session->set('cart', $GLOBALS['cart']);
     }
     // create an instance of the customer class
     if ($osC_Session->exists('osC_Customer')) {
         $GLOBALS['osC_Customer'] =& $osC_Session->value('osC_Customer');
     } else {
         $GLOBALS['osC_Customer'] = new osC_Customer();
         $osC_Session->set('osC_Customer', $GLOBALS['osC_Customer']);
     }
     // navigation history
     if ($osC_Session->exists('navigation')) {
         $GLOBALS['navigation'] =& $osC_Session->value('navigation');
     } else {
         $GLOBALS['navigation'] = new navigationHistory();
         $osC_Session->set('navigation', $GLOBALS['navigation']);
     }
     $GLOBALS['navigation']->add_current_page();
     // add messages in the session to the message stack
     $messageStack->loadFromSession();
     return true;
 }
Пример #10
0
 tep_session_register('customer_id');
 tep_session_register('customer_default_address_id');
 tep_session_register('customer_first_name');
 tep_session_register('customer_middle_name');
 tep_session_register('customer_last_name');
 tep_session_register('customer_status');
 tep_session_register('customer_company');
 tep_session_register('customer_corporate');
 tep_session_register('customer_type');
 tep_session_register('customer_country_id');
 tep_session_register('customer_zone_id');
 tep_session_unregister('is_dummy_account');
 if ($HTTP_POST_VARS['remember_me'] == '1') {
     $pass_info_query = tep_db_query("select customers_password from " . TABLE_CUSTOMERS . " where customers_id = '" . (int) $customer_id . "'");
     $pass_info = tep_db_fetch_array($pass_info_query);
     tep_setcookie('remember_customer', $pass_info['customers_password'] . '||' . $customer_id, time() + 60 * 60 * 24 * 365);
 }
 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 . "'");
 tep_db_query("update " . TABLE_CUSTOMERS . " set shops_id = '" . (int) SHOP_ID . "' where customers_id = '" . (int) $customer_id . "' and shops_id = '0'");
 // restore cart contents
 $cart->restore_contents();
 // restore postpone cart contents
 $postpone_cart->restore_contents();
 // restore foreign cart contents
 $foreign_cart->restore_contents();
 if (MODULE_ORDER_TOTAL_INSTALLED) {
     require DIR_WS_CLASSES . 'order.php';
     $order = new order();
     require DIR_WS_CLASSES . 'order_total.php';
     $order_total_modules = new order_total();
     $order_total_modules->process();