Hello,
Kinda new to this site, but I need help.
I have a page that can view all the files in a directory on my server but I can not get it to delete selected files with checkboxes.
Anyway here is my code, any help is appreciated.
<?php
session_start();
if($_SESSION['user-agent'] != $_SERVER['HTTP_USER_AGENT']){
die ("noauth");
}
if($_SESSION['auth']!=1){
die ("noauth");
}
?>
<head>
<title>FiST</title>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
<link rel="stylesheet" type="text/css" href="../css/fnp3.css" />
<link rel="stylesheet" type="text/css" href="../css/fist.css" />
<script language="Javascript" type="text/javascript" src="../pagestructure/bbox.js"></script>
</head>
<body>
<?php
echo DoHeader(1);
echo DoContainerTopLid(1);
if (isset($_POST['submit'])) {
unlink($_POST['Del']);
}
?>
<div class="ContainerContents">
<?php //Since this file is part of a web application, verify permission for that application.
if($_SESSION['FIST']==''){
echo '<p>FiST is not an application that you have permission to use.</p>'.PHP_EOL;
}
else { //Show the application.
?>
<div id="applicationHeader">
<?php require('fist_header.php5'); ?>
</div>
<div id="applicationInterface">
<div class="BBoxFt">
<?php echo table_list($_SESSION['FIST']); ?>
</div>
<div class="BBox">
<div class="BBoxBd">
<form name="download" action="download.php5" method="POST">
<input name="ObjectName" type="hidden" maxlength="10" value="Del" /><ul>
<?php
$dir = opendir('uploads/');
echo '<ul>';
while ($read = readdir($dir)){
if ($read!='.' && $read!='..'){
echo '<li><a href="uploads/'.$read.'" target="_blank">'.$read.' </a>';
echo ' <input type="checkbox" name="Del" value='.$read.' />Delete';
}
}
echo '<br /><br />';
echo '<input type="submit" name="Del" value="Delete Checked Items"><br>';
echo '</ul>';
closedir($dir);
?>
</form>
</div>
</div>
</div><!-- end AppInterface -->
<div id="applicationFooter">
<?php require('fist_footer.php5'); ?>
</div>
<?php
}
?>
</div><!-- end container contents -->
<?php
echo DoContainerBottomLid(1);
echo DoFooter(1);
?>
</body>
</html>