Favor verificar o código abaixo, esta contendo algum erro pois a exclusão não esta sendo efetuada. <?php
include ('seguranca.php');
include ('../language/idioma.php');
$lang = $_GET["lang"];
$pasta = substr($_GET['pasta'],0,-5);
?>
<style type="text/css">
body,td,th {
font-family: Lucida Sans Unicode;
font-size: 12px;
font-weight: bold;
}
</style>
<?php
$dir = 'paginas/$lang/$pasta/';
removeTree($dir);
?>
<?php
include("conecta.php");
function removeTree($rootDir)
/**
* Função para remover um diretório sem ter que apagar manualmente cada arquivo e pasta dentro dele
*
* ATENÇÃO!
*
* Muito cuidado ao utilizar esta função! Ela apagará todo o conteúdo dentro do diretório
* especificado sem pedir qualquer confirmação. Os arquivos não poderão ser recuperados.
* Portanto, só utilize-a se tiver certeza de que deseja apagar o diretório.
*
*
* Autor: Carlos Reche
* E-mail: carlosreche@yahoo.com
*
*
*/
{
if (!is_dir($rootDir))
{
return false;
}
if (!preg_match("/\\/$/", $rootDir))
{
$rootDir .= '/';
}
$stack = array($rootDir);
while (count($stack) > 0)
{
$hasDir = false;
$dir = end($stack);
$dh = opendir($dir);
while (($file = readdir($dh)) !== false)
{
if ($file == '.' || $file == '..')
{
continue;
}
if (is_dir($dir . $file))
{
$hasDir = true;
array_push($stack, $dir . $file . '/');
}
else if (is_file($dir . $file))
{
unlink($dir . $file);
}
}
closedir($dh);
if ($hasDir == false)
{
array_pop($stack);
rmdir($dir);
}
}
return true;
}
?>
E o arquivo que pega o código:
<?php
include ('seguranca.php');
include ('../language/idioma.php');
$lang = strtolower($_GET["lang"]);
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Untitled Document</title>
<style type="text/css">
<!--
body,td,th {
font-family: Lucida Sans Unicode;
font-size: 12px;
font-weight: bold;
}
-->
</style></head>
<body>
<p align="left"><a href="java script:history.go(-1)"><?php echo voltar; ?></a></p>
<br />
<?php echo visualizarthumb ?>
<form id="form1" name="form1" method="post" action="excluir2.php?lang=<?php echo $lang ?>">
<table width="75%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="6%"><?php echo pasta ?></td>
<td width="94%"><label>
<select name="pasta" id="pasta">
<?php
// variável que define o diretório das imagens
$dir = "paginas/$lang";
// esse seria o "handler" do diretório
$dh = opendir($dir);
// loop que busca todos os arquivos até que não encontre mais nada
while (false !== ($entrada = readdir($dh))) {
// verificando se o arquivo é .jpg
if ($entrada=='.' || $entrada=='..')
continue;
echo "<option value='$entrada'>".$entrada."</option>";
}
?>
</select>
</label></td>
</tr>
<tr>
<td colspan="2"><label>
<input type="submit" name="Submit" value="<?php echo enviar; ?>"/>
</label></td>
</tr>
</table>
</form>
</body>
</html> Grato.