<?php
$id = $_GET['id'];
$n = $_GET['name_file'];
$file_to_delete = 'xxxxx/'.$n;//path including filename
require_once('../../xxxx/connect.php');
$error = "";
if ($_GET) {
if (isset($_GET['id'])) {
$deleteQuery = 'DELETE FROM xxxxx WHERE id = '. mysql_real_escape_string(urldecode($_GET['id']));
if ($result = mysql_query($deleteQuery)) {
echo "<script language=\"JavaScript\">alert ('$n deleted successfully');
location.replace(\"xxx.php\");
</script>";
}else {
$error .= '<font color=red><i>Sorry, there was an error Deleting $n<br>' . (mysql_error()) . '</i></font><br>';
}
}
}
if($result) {
unlink($file_to_delete);
echo 'Done!<br />';
}
?>
|