<?php
  session_start();
  if(!isset($_SESSION["USERID"])){
  header("Location: ../../login.php");
  exit;
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html lang="ja" xml:lang="ja">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta http-equiv="Content-Style-Type" content="text/css">
<meta name="ROBOTS" content="NOINDEX">
<meta name="viewport" content="width=device-width, initial-scale=1, minimum-scale=1, maximum-scale=1, user-scalable=yes" />
<title><?php print("$title");?></title>
<link rel="stylesheet" href="../../control/style.css" type="text/css">
<link rel="stylesheet" href="../../control/style_768.css" type="text/css">
<link rel="stylesheet" href="../../foundation-icons/foundation-icons.css" />
</head>
<body>
<?php

  function delete(){

  $d_name = $_GET['name'];
  $dele = $_POST['dele'];
  $file = $_POST['file'];

  if($dele =="1"){

    if(strpos($d_name,'linkGroup') !== false OR strpos($d_name,'html_tag') !== false){
    $dele_file = '../'.$file.'.inc';
    unlink($dele_file);

    }elseif(strpos($d_name,'img_up') !== false){
    $dele_file = '../'.$file;
    unlink($dele_file);

    }else{
    $dele_file1 = '../'.$file.'.php';
    $dele_file2 = '../'.$file.'.inc';
    unlink($dele_file1);
    unlink($dele_file2);
    }

  $form = <<<EOD
<br><br>
<div id="main_r1">
<h2>削除の実行結果</h2>
<br><br>　コンテンツ【{$d_name}】を削除いたしました。
<br><br>
<div id="border_box">
<a href="#" class="but1" onClick="window.opener.location.reload();window.close(); return false;"><div class="fi-x"> 閉じる CLOSE</div></a>
</div>
<br><br>
</div>
EOD;

  print $form;

  }else{

  $form = <<<EOD
<br><br>
<div id="main_r1">
<h2>削除の確認　Dlete</h2>
<br><br>　【{$d_name}】を削除してよろしいですか？
<br><br>
<div id="border_box">
<a href="#" class="but1" onClick="window.close(); return false;"><div class="fi-x"> キャンセル Cansell</div></a>
<form action="./delete.php?name=$d_name" method="post">
<input type="hidden" name="file" value="{$d_name}">
<input type="hidden" name="dele" value="1">
<button class="d_button" type="submit"><div class="fi-trash"> 削除 DELETE</div></button>
</form>
</div>
<br><br>

</div>
EOD;

  print $form;
  }

}
delete();

?>
</body>
</html>
