0)) { $requests = explode("&", $URI_elements[1]); } if (sizeof($requests) > 0) { for ($i = 0, $n = sizeof($requests); $i < $n; $i++) { $param = explode("=", $requests[$i]); $_GET[$param[0]] = $param[1]; } } if ( $URI_elements[0] == "uk/index.php" or $URI_elements[0] == "uk/") { $_GET['language'] = 'uk'; $PHP_SELF = '/index.php'; include('index.php'); die(); } if ( $URI_elements[0] == "ru/index.php" or $URI_elements[0] == "ru/") { $_GET['language'] = 'ru'; $PHP_SELF = '/index.php'; include('index.php'); die(); } if (isset($URI_elements[0]) && (strlen($URI_elements[0]) > 0)) { require_once('includes/configure.php'); require_once('includes/database_tables.php'); require_once('inc/vam_db_prepare_input.inc.php'); $categories_array = array(); $path_elements = explode("/", $URI_elements[0]); $URI_elements[0] = $path_elements[sizeof($path_elements) - 1]; $db_l = mysqli_connect(DB_SERVER, DB_SERVER_USERNAME, DB_SERVER_PASSWORD, DB_DATABASE); //maxua url brand // if (in_array($_SERVER['HTTP_X_FORWARDED_FOR'],array('80.70.77.146'))) { // error_reporting(E_ALL & ~E_NOTICE & ~E_STRICT); // echo count($path_elements); if (count($path_elements)>1) { // print_r($path_elements); // print_r($URI_elements); //print_r($path_elements);echo count($path_elements)-1 ;die(); $query = 'select categories_id , categories_status from ' . TABLE_CATEGORIES . ' where categories_url="' . vam_db_prepare_input($path_elements[ count($path_elements) - 2 ]) . '.html"'; $result = mysqli_query($db_l, $query); if (mysqli_num_rows($result) > 0) { $row = mysqli_fetch_array($result, MYSQLI_ASSOC); // print_R($row); } $path_elements[ count($path_elements) - 1 ] = str_replace("+",' ',$path_elements[ count($path_elements) - 1]); // $path_elements[1] = str_replace("-",' ',$path_elements[1]); $querym = 'select manufacturers_id,manufacturers_name,manufacturers_seo_url from ' . TABLE_MANUFACTURERS . ' where BINARY manufacturers_name="'. vam_db_prepare_input(str_replace(".html","", $path_elements[ count($path_elements) - 1 ])) . '"'; $resultm = mysqli_query($db_l,$querym); if (mysqli_num_rows($resultm) > 0) { $rowm = mysqli_fetch_array($resultm, MYSQLI_ASSOC); // print_R($rowm); // // echo $querym; //print_r($rowm); //die(); if ((int)$row['categories_id']>0 && (int)$rowm['manufacturers_id']>0) { // $redir = "/products_filter.php?cat=".$row['categories_id']."&f744[".(int)$rowm['manufacturers_id']."]=".$rowm['manufacturers_name']; $_GET['cat'] = $row['categories_id']; // $_GET['f173['.(int)$rowm['manufacturers_id'].']'] = $rowm['manufacturers_name']; $_GET['f470'] = array((int)$rowm['manufacturers_id'] => $rowm['manufacturers_name']); //if ($_SERVER['REMOTE_ADDR'] == '31.43.181.249') { //error_reporting(1); //ini_set('display_errors',1); //error_reporting(E_ALL & ~E_NOTICE); require_once(DIR_FS_CATALOG.'manuf_arr.php'); $murl = manufspecarr((int)$rowm['manufacturers_id']); // $path_elements[ count($path_elements) - 1] = "f/brendi_val-".$rowm['manufacturers_seo_url']; if ($murl!='') { $path_elements[ count($path_elements) - 1] = "f/brendi_val-".$murl.".html"; $redir_url = implode("/",$path_elements); // echo "
".$redir_url; header("HTTP/1.1 301 Moved Permanently"); header("Location: ".HTTPS_SERVER.'/'.$redir_url.""); exit(); } //die(); //} // $_GET['f425'] = $rowm['manufacturers_name']; // $_GET['f173'] = array(48 => $rowm['manufacturers_name']); // echo $redir; // print_r($_GET); /* https://svitovederevo.com.ua/uk/spirulina-platensis/f/brendi_val-baidyanath-goodcare.html uk/spirulina-platensis/f/brendi_val-baidyanath-goodcare.html https://svitovederevo.com.ua/uk/spirulina-platensis/Baidyanath+(Goodcare).html https://svitovederevo.com.ua/uk/ustalost-i-upadok-sil/f/brendi_val-dabur-india.html */ if ($path_elements[0]=='uk') $_GET['language'] = 'uk'; $matched = true; $brenURL = true; mysqli_free_result($result); mysqli_close($db_l); $PHP_SELF = '/products_filter.php'; include('products_filter.php'); die(); } } } // } $brenURL = false; //maxua url brand $query = 'select categories_id from ' . TABLE_CATEGORIES . ' where BINARY categories_url="' . vam_db_prepare_input($URI_elements[0]) . '"'; $result = mysqli_query($db_l, $query); if (mysqli_num_rows($result) > 0) { $row = mysqli_fetch_array($result, MYSQLI_ASSOC); $cId = $row['categories_id']; $matched = true; } else { $matched = false; } if ($matched) { $HTTP_GET_VARS['cat'] = $cId; $_GET['cat'] = $cId; mysqli_free_result($result); mysqli_close($db_l); $PHP_SELF = '/index.php'; include('index.php'); } else { mysqli_free_result($result); $query = 'select products_id from ' . TABLE_PRODUCTS . ' where BINARY products_page_url="' . vam_db_prepare_input($URI_elements[0]) . '"'; $result = mysqli_query($db_l, $query); if (mysqli_num_rows($result) > 0) { $row = mysqli_fetch_array($result, MYSQLI_ASSOC); $pId = $row['products_id']; $matched = true; } else { $matched = false; } if ($matched) { $HTTP_GET_VARS['products_id'] = $pId; $_GET['products_id'] = $pId; mysqli_free_result($result); mysqli_close($db_l); $PHP_SELF = '/product_info.php'; include('product_info.php'); } else { //manuf mysqli_free_result($result); $query = 'select manufacturers_id from ' . TABLE_MANUFACTURERS . ' where BINARY manufacturers_seo_url="' . vam_db_prepare_input($URI_elements[0]) . '"'; $result = mysqli_query($db_l,$query); // print_r(); // die(vam_db_prepare_input($URI_elements[0]).mysqli_num_rows($result)); if (mysqli_num_rows($result) > 0) { $row = mysqli_fetch_array($result, MYSQLI_ASSOC); $mId = $row['manufacturers_id']; $matched = true; } else { $matched = false; } if ($matched) { $HTTP_GET_VARS['manufacturers_id'] = $mId; $_GET['manufacturers_id'] = $mId; // die($mId); mysqli_free_result($result); mysqli_close(); $PHP_SELF = '/index.php'; include('index.php'); } else { //manuf mysqli_free_result($result); $query = 'select content_id from ' . TABLE_CONTENT_MANAGER . ' where BINARY content_page_url="' . vam_db_prepare_input($URI_elements[0]) . '" order by content_id'; $result = mysqli_query($db_l, $query); if (mysqli_num_rows($result) > 0) { $row = mysqli_fetch_array($result, MYSQLI_ASSOC); $coID = $row['content_id']; // print_r($row); // die(); $matched = true; } else { $matched = false; } if ($matched) { $HTTP_GET_VARS['coID'] = $coID; $_GET['coID'] = $coID; mysqli_free_result($result); mysqli_close($db_l); $PHP_SELF = '/shop_content.php'; include('shop_content.php'); } else { mysqli_free_result($result); $query = 'select articles_id from ' . TABLE_ARTICLES . ' where BINARY articles_page_url="' . vam_db_prepare_input($URI_elements[0]) . '"'; $result = mysqli_query($db_l, $query); if (mysqli_num_rows($result) > 0) { $row = mysqli_fetch_array($result, MYSQLI_ASSOC); $aID = $row['articles_id']; $matched = true; } else { $matched = false; } if ($matched) { $HTTP_GET_VARS['articles_id'] = $aID; $_GET['articles_id'] = $aID; mysqli_free_result($result); mysqli_close($db_l); $PHP_SELF = '/article_info.php'; include('article_info.php'); } else { mysqli_free_result($result); $query = 'select topics_id from ' . TABLE_TOPICS . ' where BINARY topics_page_url="' . vam_db_prepare_input($URI_elements[0]) . '"'; $result = mysqli_query($db_l, $query); if (mysqli_num_rows($result) > 0) { $row = mysqli_fetch_array($result, MYSQLI_ASSOC); $tID = $row['topics_id']; $matched = true; } else { $matched = false; } if ($matched) { $HTTP_GET_VARS['tPath'] = $tID; $_GET['tPath'] = $tID; mysqli_free_result($result); mysqli_close($db_l); $PHP_SELF = '/articles.php'; include('articles.php'); } else { mysqli_free_result($result); $query = 'select news_id from ' . TABLE_LATEST_NEWS . ' where BINARY news_page_url="' . vam_db_prepare_input($URI_elements[0]) . '"'; $result = mysqli_query($db_l, $query); if (mysqli_num_rows($result) > 0) { $row = mysqli_fetch_array($result, MYSQLI_ASSOC); $nID = $row['news_id']; $matched = true; } else { $matched = false; } if ($matched) { $HTTP_GET_VARS['news_id'] = $nID; $_GET['news_id'] = $nID; mysqli_free_result($result); mysqli_close($db_l); $PHP_SELF = '/news.php'; include('news.php'); } else { $query = 'select faq_id from ' . TABLE_FAQ . ' where BINARY faq_page_url="' . vam_db_prepare_input($URI_elements[0]) . '"'; $result = mysqli_query($db_l, $query); if (mysqli_num_rows($result) > 0) { $row = mysqli_fetch_array($result, MYSQLI_ASSOC); $fID = $row['faq_id']; $matched = true; } else { $matched = false; } if ($matched) { $HTTP_GET_VARS['faq_id'] = $fID; $_GET['faq_id'] = $fID; mysqli_free_result($result); mysqli_close($db_l); $PHP_SELF = '/faq.php'; include('faq.php'); } else { mysqli_free_result($result); mysqli_close($db_l); // header('HTTP/1.1 404 Not Found'); $PHP_SELF = '/index.php'; // $PHP_SELF = '/404.html'; // include('index.php'); header('HTTP/1.1 404 Not Found'); $_GET['coID'] = '27'; // 12 - это id нужной информационной страницы include('shop_content.php'); exit(); } } } } } } } } } else { $PHP_SELF = '/index.php'; include('index.php'); } function get_parent_categories(&$categories, $categories_id) { $parent_categories_query = "select parent_id from " . TABLE_CATEGORIES . " where categories_id = '" . (int)$categories_id . "'"; $result = mysqli_query($db_l, $parent_categories_query); while ($parent_categories = mysqli_fetch_array($result, MYSQLI_ASSOC)) { if ($parent_categories['parent_id'] == 0) return true; $categories[sizeof($categories)] = $parent_categories['parent_id']; if ($parent_categories['parent_id'] != $categories_id) { get_parent_categories($categories, $parent_categories['parent_id']); } } } function product_path($products_id) { $cPath = ''; $category_query = "select p2c.categories_id from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c where p.products_id = '" . (int)$products_id . "' and p.products_status = '1' and p.products_id = p2c.products_id limit 1"; $category = mysqli_query($db_l, $category_query); if (mysqli_num_rows($category) > 0) { $category = mysqli_fetch_array($category, MYSQLI_ASSOC); $categories = array(); get_parent_categories($categories, $category['categories_id']); $categories = array_reverse($categories); $cPath = implode('_', $categories); if (not_null($cPath)) $cPath .= '_'; $cPath .= $category['categories_id']; } return $cPath; } function not_null($value) { if (is_array($value)) { if (sizeof($value) > 0) { return true; } else { return false; } } else { if (($value != '') && (strtolower($value) != 'null') && (strlen(trim($value)) > 0)) { return true; } else { return false; } } }