Codice PHP:
<?php
ob_start();
session_start();
if ($_SESSION['login_staff'] != "ok") {
header("Location: login.php"); exit;
} else {
include "../connect.php";
$iddocenti = $_POST['iddocenti'];
$key = "iddocenti = $iddocenti";
$query = mysql_query("SELECT * FROM docenti WHERE $key");
$num = mysql_num_rows($query);
if ($num != 0) {
$row = mysql_fetch_array($query);
$path = "../files/docenti";
chmod ($path, 777);
$allegato = stripslashes(urldecode($row[allegato]));
if (file_exists("$path/$allegato")) { unlink("$path/$allegato"); }
else{ $query = mysql_query("DELETE FROM docenti WHERE $key"); }
}
header("Location: docenti_elenco.php");
exit;
}
ob_end_flush();
?>
A qualcuno però non funge....