Ejemplo n.º 1
0
 }
 $HTTP_REFERER = isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : getenv('HTTP_REFERER');
 $same_site_referer = strpos($HTTP_REFERER, str_replace('http://', '', str_replace('www.', '', HTTP_SERVER))) !== false;
 if (SHOP_LISTING_STATUS == '1' && $spider_flag == false && basename(SCRIPT_FILENAME) != FILENAME_PRICELIST && substr(PHP_SELF, 0, 5) != '/ext/') {
     //	  if ($_SERVER['REMOTE_ADDR']=='94.199.108.66') {
     $request_uri = $_SERVER['REQUEST_URI'];
     if ($request_uri == DIR_WS_CATALOG) {
         $request_uri = '';
     }
     if (tep_session_is_registered('session_country_shop')) {
         list($session_country_code, $session_shop_id) = explode(':', $session_country_shop);
         if ($session_shop_id != SHOP_ID && tep_not_null($session_country_code)) {
             tep_redirect_to_shop($session_shop_id);
         }
     } else {
         $country_code = tep_get_ip_info();
         if (tep_not_null($country_code)) {
             //		  if (tep_not_null($HTTP_REFERER) || tep_not_null($request_uri)) {
             $referer_contents = parse_url($HTTP_REFERER);
             $shop_check_query = tep_db_query("select count(*) as total from " . TABLE_SHOPS . " where (shops_url = '" . tep_db_input($referer_contents['scheme'] . '://' . $referer_contents['host']) . "' or shops_ssl = '" . tep_db_input($referer_contents['scheme'] . '://' . $referer_contents['host']) . "') and shops_listing_status = '1'");
             //			if ($_SERVER['REMOTE_ADDR']=='94.199.108.66') { print_r($_SERVER); die; }
             $shop_check = tep_db_fetch_array($shop_check_query);
             if ($shop_check['total'] < 1 && !in_array($HTTP_GET_VARS['from'], array('direct', 'adwords'))) {
                 tep_redirect_to_shop('', $country_code);
             } else {
                 $session_country_shop = $country_code . ':' . SHOP_ID;
                 tep_session_register('session_country_shop');
             }
             //		  }
         } else {
             $empty_country_dir = DIR_FS_CATALOG . 'cache/countries/';
Ejemplo n.º 2
0
switch ($action) {
    case 'new':
        $adv_info = array();
        if (tep_not_null($HTTP_POST_VARS)) {
            $adv_info = $HTTP_POST_VARS;
        } else {
            $customer_info_query = tep_db_query("select customers_email_address, customers_telephone from " . TABLE_CUSTOMERS . " where customers_id = '" . (int) $customer_id . "'");
            $customer_info = tep_db_fetch_array($customer_info_query);
            if ($customer_default_address_id > 0) {
                $adv_info_query = tep_db_query("select entry_city as customers_city, entry_state as customers_state, entry_country_id, entry_telephone as customers_telephone from " . TABLE_ADDRESS_BOOK . " where customers_id = '" . (int) $customer_id . "' and address_book_id = '" . (int) $customer_default_address_id . "' order by address_book_id desc limit 1");
                $adv_info = tep_db_fetch_array($adv_info_query);
                $adv_info['customers_country'] = tep_get_country_name($adv_info['entry_country_id']);
            } else {
                $all_countries = tep_get_shops_countries();
                $customer_country_code = isset($_SERVER['GEOIP_COUNTRY_CODE']) ? $_SERVER['GEOIP_COUNTRY_CODE'] : tep_get_ip_info();
                reset($all_countries);
                while (list(, $country_info) = each($all_countries)) {
                    if ($country_info['country_code'] == $customer_country_code) {
                        $adv_info['customers_country'] = $country_info['country_name'];
                        break;
                    }
                }
            }
            $adv_info['customers_name'] = preg_replace('/\\s{2,}/', ' ', trim($customer_first_name . ' ' . $customer_middle_name . ' ' . $customer_last_name));
            $adv_info['boards_condition'] = '5';
            $adv_info['boards_quantity'] = '1';
            $adv_info = array_merge($customer_info, $adv_info);
            if (isset($HTTP_GET_VARS['products_id'])) {
                $product_info_query = tep_db_query("select products_id, products_model, products_year, authors_id, manufacturers_id from " . TABLE_PRODUCTS . " where products_id = '" . (int) $HTTP_GET_VARS['products_id'] . "'");
                $product_info = tep_db_fetch_array($product_info_query);