<?php
require_once('session.php');
require_once('../fun/funsql.php'); 
require_once('../fun/funlogic.php');
if (isset($_GET["rel"])){$rel=$_GET["rel"];}else{$rel="";}
if (isset($_GET["path"])){$path=$_GET["path"];}else{$path="";}
$dir='../temp/';
?>
<!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=utf-8" />
<title> Home</title>
<link href="css_body.css" rel="stylesheet" type="text/css" />
</head>
<script type="text/javascript" src="../fun/adminjs.js"></script>
<body>
<?php if($rel==''){?>
<div class='bodytitle'><div class='bodytitleleft'></div><div class='bodytitletxt'><?php echo $dir.$path; ?>列表</div></div>
<table width="96%" border="0" cellpadding="0" cellspacing="0" align="center" style="margin-bottom:8px;display:block" id="td1" >
<tr> 
<td>
<table width="100%" border="0" cellpadding="1" cellspacing="1" bgcolor="#E2F5BC" class="sysinfo">
<tr align="center"> 
<td  height="25" bgcolor="#FFFFFF" align="left">名称</td>
<td bgcolor="#FFFFFF" align="left">属性</td>
<td bgcolor="#FFFFFF" align="left">大小</td>
<td bgcolor="#FFFFFF" align="left">修改时间</td>
<td bgcolor="#FFFFFF" align="left">管理</td>
</tr>
<?php 
$dp=listdir($dir.'/'.$path,2);
$dps=explode(",,",$dp);
$dpi=0;
while($dpi<(count($dps)-1)){
?>
<tr align="center"> 
<td  height="25" bgcolor="#FFFFFF" align="left"><?php if(filetype($dir.$path.'/'.$dps[$dpi])=='dir'){?><img src="images/dir.gif"><a href="style.php?path=<?php echo $path.'/'.$dps[$dpi]; ?>"><?php echo $dps[$dpi]; ?></a><?php }else{echo "<img src=\"images/htm.gif\">".$dps[$dpi];}?></td>
<td bgcolor="#FFFFFF" align="left"><?php echo filetype($dir.$path.'/'.$dps[$dpi]); ?></td>
<td bgcolor="#FFFFFF" align="left"><?php echo (filesize($dir.$path.'/'.$dps[$dpi])/1000)."KB"; ?></td>
<td bgcolor="#FFFFFF" align="left"><?php echo date("Y-m-d H:i:s",filectime($dir.$path.'/'.$dps[$dpi])); ?></td>
<td bgcolor="#FFFFFF" align="left"><?php if(filetype($dir.$path.'/'.$dps[$dpi])<>'dir'){?><a href="style.php?rel=file_info&path=<?php echo $path; ?>&id=<?php echo $path.'/'.$dps[$dpi]; ?>">修改</a> <a href="style.php?rel=file_del&path=<?php echo $path; ?>&id=<?php echo $path.'/'.$dps[$dpi]; ?>">删除</a><?php }?></td>
</tr>
<?php 
$dpi+=1;
}?>

</table>
</td>
</tr>
</table>
<?php }?>
<?php 
if($rel=='file_del'){
  $id=$_GET["id"];
  @unlink($dir.$id);
  echo tanshow("","style.php?path=".$path);
}
?>
<?php 
if($rel=='file_info_cmd'){
  $id=$_POST["id"];
  $files=$_POST["files"];
  $path=$_POST["path"];
  $files=str_replace("\\","",$files);
  createfile($dir.$id,$files);
  
  echo tanshow("","style.php?path=".$path);
}
?>

<?php if($rel=='file_info'){
 $id=$_GET["id"];
 $files=openfile($dir.$id);
?>

<div class='bodytitle'><div class='bodytitleleft'></div><div class='bodytitletxt'><?php echo $dir.$id; ?>修改</div></div>
<table width="96%" border="0" cellpadding="0" cellspacing="0" 
	align="center" style="margin-bottom:8px;display:block" id="td1" >
<tr> 
<td>
<form id="form1" name="form1" method="post" action="style.php?rel=file_info_cmd">
<table width="100%" border="0" cellpadding="1" cellspacing="1" bgcolor="#E2F5BC" class="sysinfo">
<tr align="center"> 
<td bgcolor="#FFFFFF" align="center"><textarea name="files" rows="30" cols="130"><?php echo $files; ?></textarea></td>
</tr> 
  <tr align="center" height="24">
  <td height="30" bgcolor="#FFFFFF" align="center">
  <input type="hidden" name="path" value="<?php echo $path; ?>" />
  <input type="hidden" name="id" value="<?php echo $id; ?>" />
  <input type="submit" name="Submit3" value="确定" />
      <input type="reset" name="Submit2" value="重置" />
  </td>
  </tr>
</table>
</form>
</td>
</tr>
</table>
<?php }?>


<?php mysql_close();?>
</body>
</html>