<?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 fdel">
<?php
$result = $mysqli->query("SELECT * FROM sections WHERE insert_id='{$_REQUEST['id']}' AND lang_id=$lang");
$row = $result->fetch_array(); 
$catid=$row['insert_id'];
$section=$row['name'];
?>
<?php echo $admindelete ?> <?php echo $section ?>
</div>
<div class="framein">

<?php
if  (isset($_POST['deletecat'.$catid]) && $catid) {
$catid = $mysqli->real_escape_string(stripslashes($_REQUEST['catid']));
	
if (file_exists("./".$filepath."sections/".$catid.".jpg")) {
unlink("./".$filepath."sections/".$catid.".jpg");
	}
$mysqli->query("DELETE FROM sections WHERE parent=$catid");
$mysqli->query("DELETE FROM sections WHERE insert_id=$catid");
$mysqli->query("ALTER TABLE sections AUTO_INCREMENT = 1");
?>
<meta http-equiv="refresh" content="0">  

<?php } else {?>

<?php
$result1 = $mysqli->query("SELECT * FROM sections WHERE parent=$catid AND lang_id=$lang");
$nrrows1 = mysqli_num_rows($result1);
?>

<?php if ($catid) { ?>
<form name="forma" method="post" enctype="multipart/form-data">
<input type="hidden" name="catid" value="<?php echo $catid ?>">

     <?php if ($nrrows1>0) { ?>
       <b> <?php echo $allrows ?> </b>
   <?php echo $admindeltext ?> 
  <?php } ?>

     <hr>
  <div class="divallbuttons">
<div class="divlist"></div>  
<div class="divbuttons">
<button type="submit" name="deletecat<?php echo $catid ?>" class="linkoption linkdelete" title="<?php echo $admindelete ?>"><span class="icon fa-trash-o"></span> <?php echo $admindelete ?></button>
</div>
   </div>
   
</form>
<?php } else {?>
<?php echo $admindeleted ?>
<?php } ?>

<?php } ?>  
</div>
</div>
</div>

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

</body>
</html>