You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
77 lines
3.1 KiB
77 lines
3.1 KiB
<div class="row">
|
|
<div class="col-12">
|
|
<div class="section-title">Elimina file</div>
|
|
</div>
|
|
<div class="col-12">
|
|
|
|
<div class="sheet-box p-4">
|
|
|
|
<?php
|
|
if($_POST['go']){
|
|
|
|
|
|
foreach ($_POST['files'] as $index => $file) {
|
|
|
|
$qf=mysqli_query($conn, "SELECT * FROM files WHERE id='$file'");
|
|
$rf = mysqli_fetch_array($qf);
|
|
|
|
@unlink("..".$rf['path']."/".$rf['filename']);
|
|
mysqli_query($conn, "DELETE FROM files WHERE id='$file'");
|
|
}
|
|
|
|
|
|
echo '<div class="col-10 text-center mx-auto my-5">
|
|
<p><i class="fa fa-check-circle font-alert p-4"></i></p>
|
|
File eliminato correttamente!
|
|
</div>';
|
|
|
|
|
|
}else{
|
|
?>
|
|
<form method="post" enctype="multipart/form-data">
|
|
<div class="row">
|
|
<div class="col-12">
|
|
<span class="font-12">Carica in</span>
|
|
<select name="path" onChange="this.form.submit()">
|
|
<option value="">- Seleziona una sezione - </option>
|
|
<option value="/docs/modulistica/pubblica" <?php if($_POST['path']=="/docs/modulistica/pubblica"){echo "selected";}?>>Modulistica pubblica</option>
|
|
<option value="/docs/modulistica/privata" <?php if($_POST['path']=="/docs/modulistica/privata"){echo "selected";}?>>Modulistica privata</option>
|
|
</select>
|
|
</div>
|
|
</div>
|
|
</form>
|
|
<form method="post" enctype="multipart/form-data">
|
|
<input type="hidden" name="path" value="<?= $_POST['path'];?>">
|
|
<div class="col-12 p-0 admin-list">
|
|
<?php
|
|
if($_POST['path']){
|
|
|
|
$q = mysqli_query($conn, "SELECT * FROM files WHERE path='".$_POST['path']."' ORDER BY date DESC");
|
|
$cnt=0;
|
|
while($r = mysqli_fetch_array($q)){
|
|
$cnt++;
|
|
$bg = ($cnt%2) ? "bg-light-grey" : "bg-white";
|
|
echo "<div class=\"admin-list-item row no-gutters font-12 $bg\">
|
|
<div class=\"col-4\">".$r['title']."</div>
|
|
<div class=\"col-4\"> ".$r['filename']."</div>
|
|
<div class=\"col-3\"> ".conv_date($r['date'])."</div>
|
|
<div class=\"col-1 text-right\">
|
|
<input type=\"checkbox\" name=\"files[]\" id=\"".$r['id']."\" value=\"".$r['id']."\"><label for=\"".$r['id']."\"><i class=\"fa fa-trash\"></i></label>
|
|
</div></div>";
|
|
}
|
|
?>
|
|
</div>
|
|
<div class="col-12 text-right">
|
|
<button type="submit" name="go" value="1">Elimina file/s</button>
|
|
</div>
|
|
</form>
|
|
<?php
|
|
}
|
|
}
|
|
?>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
</div>
|
|
|