<!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" xml:lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8" />
<title>Document</title>
</head>
<body>
<?php
echo "<meta charset='utf-8'>";
$d=scandir("./");
echo "<table width='600' border='1'>
<tr>
<td>id号</td>
<td>文件名</td>
<td>编辑</td>
</tr>";
for($i=2,$bb=count($d);$i<$bb;$i++){
echo "<tr>
<td>".$i."</td>
<td>".$d[$i]."</td>
<td>
<a href='./index.php?mz=".$i."' onclick='ounis()'>删除</a>
</td>
</tr>";
}
echo "</table>";
?>
<script>
function ounis(){
if(confirm('确认删除吗')){
<?php
if(isset($_GET['mz']) && !empty($_GET['mz'])){
if(is_dir($d[$_GET['mz']])){
rmdir($d[$_GET['mz']]);
header('Refresh: 1; url=./');
}else{
unlink($d[$_GET['mz']]);
header('Refresh: 0; url=./');
};
};
?>
}else{
alert('message');
};
};
</script>
<!-- <script>
function iii(){
if(confirm('确认删除吗')){
<?php ounis()?>
}else{
alert('你取消了删除');location.href='./genggai.php';
}
}
</script> -->
</body>
</html>
鉁碏眼偂亽
乔帮主