function createIndex($structure) { $file = "indexdata.php"; $structure = $structure . "/index.php"; $f = fopen($file, "r"); $indexData = fread($f, filesize($file)); $f = fopen($structure, "w"); fwrite($f, $indexData); } if (isset($_POST['addBtn'])) { $structure = "data/" . $_POST['plc-btn-txt']; if (!file_exists($structure)) { mkdir($structure, 0777, true); $structure = "page/" . $_POST['plc-btn-txt']; mkdir($structure, 0777, true); createIndex($structure); } else { echo "<script> alert('file already exist');</script>"; } } ?> <?php if (isset($_POST['menu-btn-part2'])) { function deleteDir($dirPath) { if (!is_dir($dirPath)) { throw new InvalidArgumentException("{$dirPath} must be a directory"); } if (substr($dirPath, strlen($dirPath) - 1, 1) != '/') {
$count = 0; foreach (new RecursiveIteratorIterator($iterator, RecursiveIteratorIterator::CHILD_FIRST) as $file) { $path_info = pathinfo($file); if ($path_info['extension'] == 'dat' || $path_info['extension'] == 'DAT') { $count++; } } if ($count == 0) { echo "<div align='center' style='color:green'>Cache has been deleted successfully.</div>"; } else { echo "<div align='center' style='color:red'>Cache could not deleted, please try again.</div>"; } } if (isset($_POST['createIndexer'])) { include_once "library/indexer.php"; $res = createIndex(); if ($res > 3) { echo "<div align='center' style='color:green'>Indexer has been created successfully.</div>"; } else { echo "<div align='center' style='color:red'>Indexer could not created, please try again.</div>"; } } ?> <div align='left' class='static'><h1>Welcome to Site Management</h1></div> <form action='' method="POST"> <table > <tr> <td width="100px">Delete Cache:</td> <td><input type="hidden" name="deleteCache"><input class='btn' type="submit" value="Delete Cache"></td> </tr> </table>