<?php include 'sets.php';?>
<?php
$superuser="0";
?>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Webadmin <?php echo $domain ?></title>
<?php include 'codes.php';?>
</head>
<body>

<?php include 'navbar.php';?>
    
<div class="container">
<div class="frame">
<div class="frametitles flist">
<?php
if  (isset($_POST['addcat'.$_REQUEST['id']])) {
$id = $mysqli->real_escape_string(stripslashes($_REQUEST['id']));
$gcat_id = $mysqli->real_escape_string(stripslashes($_REQUEST['gcat_id']));
if ($gcat_id>0) {
$mysqli->query("INSERT INTO groups (item_id, category_id) VALUES ('$id', '$gcat_id')");
}}?>
<?php
if  (isset($_POST['additem'.$_REQUEST['id']])) {
$id = $mysqli->real_escape_string(stripslashes($_REQUEST['id']));
$gitem_id = $mysqli->real_escape_string(stripslashes($_REQUEST['gitem_id']));
if ($gitem_id>0) {
$mysqli->query("INSERT INTO groups (item_id, item_id2) VALUES ('$id', '$gitem_id')");
}}?>
<?php
if  (isset($_POST['changesection'.$_REQUEST['id']])) {
$section_id = $mysqli->real_escape_string(stripslashes($_REQUEST['section_id']));
$mysqli->query("UPDATE items SET section_id='$section_id' WHERE insert_id='{$_REQUEST['id']}'"); 
}?> 
<?php
if ($_REQUEST['secid']) { 
$secid = $mysqli->real_escape_string(stripslashes($_REQUEST['secid']));
}else{
$secid=0;
}

$result1 = $mysqli->query("SELECT insert_id, name, type FROM categories WHERE insert_id='{$_REQUEST['catid']}' AND lang_id=$lang");
$row = $result1->fetch_array(); 
$catid=$row['insert_id'];
$cat=$row['name'];
$typec=$row['type'];

$resultsc = $mysqli->query("SELECT id FROM sections WHERE lang_id=$lang");
$srows = mysqli_num_rows($resultsc);

$result1s = $mysqli->query("SELECT name, parent FROM sections WHERE insert_id='$secid' AND lang_id=$lang");
$row = $result1s->fetch_array(); 
$section=$row['name'];
$sectionparent=$row['parent'];

$result2s = $mysqli->query("SELECT * FROM sections WHERE insert_id='$sectionparent' AND lang_id=$lang");
$row = $result2s->fetch_array(); 
$section2=$row['name'];
?>
<a href="list-items.php?catid=<?php echo $catid?>&amp;secid=<?php echo $secid ?>"><?php echo $cat ?></a>
<?php if ($secid!=0) { echo '&raquo;'; } ?> <?php echo $section2 ?> <?php if ($sectionparent!=0) { echo '-'; } ?> <?php echo $section ?>

<?php
$result2 = $mysqli->query("SELECT * FROM items WHERE category_id=$catid AND section_id=$secid AND lang_id=$lang");
$rows = mysqli_num_rows($result2);
?>
 (<?php echo $rows ?>)
<div class="floatright"><a href="add-item.php?catid=<?php echo $catid?>"><img src="img/add.png" alt="<?php echo $adminadditem ?>" title="<?php echo $adminadditem ?>"></a></div>
</div>
<div class="framein">

<div id="contentlistingitem">
<ul class="nospace">
<?php
$result1 = $mysqli->query("SELECT * FROM items WHERE category_id=$catid AND section_id=$secid AND lang_id=$lang");
$rows = mysqli_num_rows($result1);

include ('pagination.php'); 

$result = $mysqli->query("SELECT * FROM items WHERE category_id='{$_REQUEST['catid']}' AND section_id=$secid AND lang_id=$lang ORDER BY priority LIMIT $start,$nritems");
while($row = $result->fetch_array()) {
$count++;
$id=$row['insert_id'];
$submitid=$row['insert_id'];
$lang_id=$row['lang_id'];
$category_id=$row['category_id'];
$section_id=$row['section_id'];
$secid=$row['section_id'];
$name=$row['name'];
$description=$row['description'];
$details=$row['details'];
$text=$row['text'];
$code=$row['code'];
$url=$row['url'];
$email=$row['email'];
$script=$row['script'];
$price=$row['price'];
$offerprice=$row['offerprice'];
$weight=$row['weight'];
$unit=$row['unit'];
$image=$row['image'];
$file=$row['file'];
$new=$row['new'];
$available=$row['available'];
$promote=$row['promote'];
$size=$row['size'];
$color=$row['color'];
$showpage=$row['showpage'];
$publish=$row['publish'];
$priority=$row['priority'];
$date=$row['date'];
?>
<?php include 'itemin.php';?>
<?php } ?>
      
<div class="divpaginate">
<?php include 'paginate.php';?>
</div>
</ul>
</div>
    
</div>
</div>
</div>

<?php include 'menudown.php';?>

</body>
</html>