首页 > 代码库 > 文件管理页面的制作

文件管理页面的制作

guanli.php

 1 <head>
 2 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
 3 <title>文件管理</title>
 4 
 5 <script src="../jquery-1.11.2.min.js"></script>
 6 
 7 <style type="text/css">
 8 .list{ width:100%; height:40px; border:1px solid #60F; margin:1px 0px 1px 0px; text-align:left; vertical-align:middle; line-height:40px;}
 9 .list:hover{ cursor:pointer}
10 .mulu{ background-color:#6FC;}
11 .prev{ background-color:#F00; color:white}
12 </style>
13 
14 </head>
15 
16 <body>
17 
18 <?php
19 session_start();
20 
21 $fname = "./qiyezhan";
22 if(!empty($_SESSION["url"]))
23 {
24     $fname = $_SESSION["url"];
25 }
26 
27 $purl = dirname($fname);
28 
29 if($fname!="./qiyezhan")
30 {
31     echo "<div class=‘list prev‘ lj=‘{$purl}‘>返回上一层</div>";
32 }
33 
34 $dir = opendir($fname);
35 
36 while($zwenjian = readdir($dir))
37 {
38     if($zwenjian!="." && $zwenjian!="..")
39     {
40         $zurl = $fname."/".$zwenjian;
41         if(is_dir($zurl))
42         {
43             echo "<div lj=‘{$zurl}‘ class=‘list mulu‘>{$zwenjian}</div>";
44         }
45         else
46         {
47             echo "<div class=‘list‘>{$zwenjian}</div>";
48         }
49         
50     }
51 }
52 
53 closedir($dir);
54 
55 ?>
56 
57 </body>
58 
59 <script type="text/javascript">
60 $(".mulu").dblclick(function(){
61         var lujing = $(this).attr("lj");
62         $.ajax({
63             url:"chuli.php",
64             data:{lj:lujing},
65             type:"POST",
66             dataType:"TEXT",
67             success: function(){
68                 window.location.href="guanli.php";
69                 }
70         });
71     })
72     
73 $(".prev").dblclick(function(){
74     var lujing = $(this).attr("lj");
75         $.ajax({
76             url:"chuli.php",
77             data:{lj:lujing},
78             type:"POST",
79             dataType:"TEXT",
80             success: function(){
81                 window.location.href="guanli.php";
82                 }
83         });
84     })
85     
86 </script>
87 </html>

 

 

 

chuli.php

1 <?php
2 session_start();
3 $lj = $_POST["lj"];
4 $_SESSION["url"] = $lj;

 

文件管理页面的制作