Pubblico tutto il codice, sperando che qualche anima pia mi dia una mano.
include_query_gallery.php
Codice PHP:
<?
if ($delete){
$sql="DELETE FROM a_photogallery
WHERE id_photogallery = '$delete'";
$query=mysql_query($sql);
$msgeliminato = "FOTO ELIMINATA";
$nome_file = $_GET['foto_big'];
$directory= "$absolute_path/";
unlink ($directory.$nome_file) or die('Impossibile eliminare il file: '.$nome_file);
echo $file_name . "è stato cancellato.";
}
?>
delete_gallery.php
Codice PHP:
<? include('include_query_gallery.php');?>
<form enctype="multipart/form-data" name="delete" action="<?=$PHP_SELF?>" method="post">
<table width="100%" border="0" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF">
<?php
$i=1;
$sqlgallery2 = "SELECT a_photogallery.*
FROM a_photogallery
WHERE a_photogallery.id_login = '$login'
ORDER BY a_photogallery.id_photogallery DESC";
$resultgallery2 = mysql_query($sqlgallery2,$conn) or die ("errore ".mysql_error());
while($rowgallery2 = mysql_fetch_array($resultgallery2)){
?>
<?php
if ($i==1){ echo "<tr align=\"center\" valign=\"top\">";
}
?>
<td align="center">
<table width="10" height="10" border="0" cellpadding="5" cellspacing="0">
<tr>
<td>[img]../pann_contr_comune/images_photogallery_utenti/<?=$rowgallery2['foto_big']?>[/img]</td>
</tr>
<tr>
<td align="center">
<?php
$foto=$rowgallery2['foto_big'];
echo $foto;
?>
<input type="submit" name="delete" value="elimina">
<input type="hidden" name="delete" value="<?$foto?>">
</td>
</tr>
</table>
</td>
<?
if ($i==4){
echo "</tr><tr align=\"center\" valign=\"top\"><td height=\"6\"></td><td></td><td></td></tr>";
$i=0;
}
$i++;
}?>
</table>
</form>