$filetodelete = $_GET['file'];
$delete = $_GET['delete'];
if ($delete == 'yes')
{
@unlink("pics/$file");
@unlink("thumbs/$file");
}
$xml = file("pics.xml");
$total = count($xml);
for ($i = 0; $i < $total; $i++)
{
if (@ereg($file,$xml[$i]))
{
$num = $i;
}
}
$first = $num;
$second = $num -1;
$third = $num -2;
$fourth = $num - 3;
for ($x = 0; $x < $total; $x++)
{
if ($x == $first || $x == $second || $x == $third || $x == $fourth)
continue;
$newcontent .= "$xml[$x]";
}
$fh = fopen("pics.xml","w");
fwrite($fh,$newcontent);
fclose($fh);
echo "
";
$dir = "pics/pics";
$fh = opendir($dir);
while ($file = readdir($fh))
{
if ($file == "." || $file == "..")
continue;
echo "$file Delete
";
}
?>