0) ? substr($cleanURL,0,$pos) : $cleanURL; // Redirect URLs are read from the database include('store/eventlog.php'); $res=mysqlquery("SELECT * FROM modrewrite WHERE uri='$cleanURLex'"); $num=mysqli_num_rows($res); if ($num>0): if (empty($redir)): /* this is a products category listing */ include ('include/session.php'); include ('include/utils.php'); startSession(); $Cat=my_sqli_result($res, 0, "Cat"); $SubCat=my_sqli_result($res, 0, "SubCat"); $ShowNoProducts=my_sqli_result($res, 0, "NoProducts"); resetfilter(); unset($_SESSION['F_Srch']); $_SESSION["F_Cat"]=$Cat; if (isset($SubCat)) $_SESSION["F_SubCat"]=$SubCat; $catstr=my_sqli_result($res, 0, "Label"); $redir=my_sqli_result($res, 0, "redir"); if (!empty($Cat)): $catres=mysqlquery("SELECT * FROM catgs WHERE CatId='$Cat'"); if (mysqli_num_rows($catres)>0) $catstr=my_sqli_result($catres, 0, "CatTitle"); if (!empty($SubCat)): $subcatres=mysqlquery("SELECT * FROM subcatgs WHERE Cat='$Cat' && SubCat='$SubCat'"); $subCatTitle=my_sqli_result($subcatres, 0, "Title"); if (!empty($subCatTitle)) $catstr.=" | $subCatTitle"; endif; // prodlist: define("MS_LAYOUT","layout2.html"); define("MS_TITLE","$catstr | Golfgear.cz"); define("MS_DESCRIPTION","Kategorie produktů $catstr"); // this needs to be added with alternate cat. descrition text $base_dir="/"; $header_page="header1"; $body_page="prodlist_body"; $footer_page="footer1"; require(MS_LAYOUT); return; endif; endif; else: /* this is proddetails.php referrer */ if (substr( $cleanURL, 0, 9 ) === "produkty/"): $OrderNo= substr($cleanURL,strrpos($cleanURL,"/")+1); // strip everything after OrderNo (i.e. AdWords ?gclid) $OrderNo= strpos($OrderNo, "?") ? substr($OrderNo, 0, strpos($OrderNo, "?")) : $OrderNo; include('proddetails.php'); exit; else: // This is articles database: $arres=mysqlquery("SELECT * FROM articles WHERE Url='$cleanURLex'"); $arnum=mysqli_num_rows($arres); if ($arnum>0): $Id=my_sqli_result($arres, 0, "Id"); $redir="article.php?Id=$Id"; else: // This is static approach: if (empty($redir)): switch ($cleanURL){ default: $redir="index.php"; } endif; endif; endif; endif; if (empty($redir)) $redir="index.php"; $path=dirname($_SERVER["PHP_SELF"]); $path=strtr($path,"\\","/"); if ($path[strlen($path)-1]!="/") $path.="/"; $redir=$path.$redir; session_write_close(); echo ''; exit; //header("Location: $redir"); //exit(); ?>