<?php include 'sets.php';?>
<?php
$itid = $mysqli->real_escape_string(stripslashes($_REQUEST['itid']));
if ($itid) {
$result = $mysqli->query("SELECT * FROM items WHERE page_id=$itid AND lang_id=$lang AND publish='yes'");
$row = $result->fetch_array(); 
$id=$row['insert_id'];
$catid=$row['category_id'];
$secid=$row['section_id'];
$pageid=$row['page_id'];
$pageitem=$row['page'];
if ($itempage==1) { $siteitem=$pageitem; }
$pagesiteitem=$siteitem.".".$pageid;
$name=$row['name'];
$name = strip_tags($name);
$description=$row['description'];
$details=$row['details'];
$text=$row['text'];
$extra=$row['extra'];
$code=$row['code'];
$url=$row['url'];
$itemail=$row['email'];
$script=$row['script'];
$price=$row['price'];
$price1=$row['price'];
$offerprice=$row['offerprice'];
$weight=$row['weight'];
$unit=$row['unit'];
$image=$row['image'];
$file=$row['file'];
$typei=$row['type'];
$new=$row['new'];
$available=$row['available'];
$showpage=$row['showpage'];
$priority=$row['priority'];
$itemdate=$row['date'];
}

if (!$id OR $pageurl!="$siteitem.$pageid") {
header ("Location: .");
exit;
}

if ($secid>0) {
$resultfs = $mysqli->query("SELECT * FROM sections WHERE insert_id=$secid AND lang_id=$lang");
$row = $resultfs->fetch_array();
$fsid=$row['insert_id'];
$separent=$row['parent'];
$sepage=$row['page'];
$secategory=$row['name'];
$secategory = strip_tags($secategory);
$setitle=$row['title'];
$sedescription=$row['description'];
$sekeywords=$row['keywords'];
$sitecompany=$secategory;
$siteactivity=$setitle;

$resultss = $mysqli->query("SELECT * FROM sections WHERE insert_id=$separent AND lang_id=$lang");
$row = $resultss->fetch_array();
$fsid1=$row['insert_id'];
$sepage1=$row['page'];
$secategory1=$row['name'];
$secategory1 = strip_tags($secategory1);
$setitle1=$row['title'];
$sedescription1=$row['description'];
$sekeywords1=$row['keywords'];
$sitecompany="$secategory - $secategory1";
$siteactivity="$setitle - $setitle1";
}

$result = $mysqli->query("SELECT * FROM categories WHERE insert_id=$catid AND lang_id=$lang");
$row = $result->fetch_array(); 
$catid1=$row['insert_id'];
$page1=$row['page'];
$category1=$row['name'];
$category1 = strip_tags($category1);
$discount=$row['discount'];
$catimage=$row['image'];
$typec=$row['type'];
$parent=$row['parent'];

$result = $mysqli->query("SELECT * FROM categories WHERE insert_id=$parent AND lang_id=$lang");
$row = $result->fetch_array(); 
$catid2=$row['insert_id'];
$page2=$row['page'];
$category2=$row['name'];
$category2 = strip_tags($category2);
$discount2=$row['discount'];
$parent2=$row['parent'];

if ($imgitem==1 AND $image==1) {
$pid=$id;
$photopath="items/";
} else {
$photopath="categories/";
if ($catimage==1 OR $catimage==2) {
$pid=$catid1;
} else {
$pid=$parent;
}
}

if ($imgitem==2) { 
$catimage='0';
} 

if ($secid>0) { 
$title1="$name - $sitecompany $category1";
} else {
$title1="$name - $category1";	
}
if ($description=='') { 
$description1="$name - $category2 $category1 $siteactivity";
} else {
$description1="$description";	
}
$keywords1="$name, $category2 $category1, $name $category1, $sitecompany $siteactivity, $siteactivity $category1, $sitecompany $page";
?>
<!DOCTYPE html>
<html lang="<?php echo $langname ?>">
<head>
<meta charset="utf-8">
<title><?php echo $title1 ?></title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="<?php echo $description1 ?>">
<meta name="keywords" content="<?php echo $keywords1 ?>">
<?php include 'codes.php';?>
</head>
<body>
<?php include 'menunav.php';?>
<div class="container">
<?php if ($menu1==1) { ?><?php include 'menu1.php';?><?php }?>
<div class="contentstyle">
<div class="pages"><div class="content"><h1><?php echo $name ?></h1> &raquo;
<h2 class="tpages"><?php if ($secid>0) {?><a href="<?php if ($fsid1) {?><?php echo $sepage1 ?>-<?php } ?><?php echo $sepage ?>.<?php echo $page1 ?>"><?php echo $secategory ?> <?php if ($fsid1) {?>&raquo; <?php echo $secategory1 ?><?php } ?> &raquo; <?php echo $category1 ?></a><?php }else{?><a href="<?php if ($catid1==1) { echo '.'; } else { echo $page1; }?>"><?php echo $category1 ?></a><?php } ?></h2></div></div>
<div class="content">
<?php if ($id) {?>
<?php include 'includes/itemin.php';?>
<?php } ?>
<div class="cleared margtop20"><?php echo $txtitems ?></div>
</div></div>
<?php if ($menu2==1) { ?><?php include 'menu2.php';?><?php }?>
</div>
<?php include 'menudown.php';?>
</body>
</html>