File tree 1 file changed +46
-0
lines changed
1 file changed +46
-0
lines changed Original file line number Diff line number Diff line change
1
+ <?php
2
+ /**
3
+ * When you call this file it will make all files and directories
4
+ * in it's own directory and all directories below writable by
5
+ * everyone
6
+ *
7
+ * You can use this to (re)gain control on files owned by the
8
+ * apache process.
9
+ *
10
+ * Only use it if you really know that this is what you want.
11
+ * Delete the file immediately after using it!
12
+ */
13
+
14
+ header ("Content-Type: text/plain " );
15
+
16
+ echo "starting... \n" ;
17
+ flush ();
18
+ traverse (dirname (__FILE__ ));
19
+ echo "finished... \n" ;
20
+
21
+ function traverse ($ dir ){
22
+ if ($ dh = opendir ($ dir )) {
23
+ while (($ file = readdir ($ dh )) !== false ) {
24
+ //skip hidden files and upper dirs
25
+ if (preg_match ('/^[\._]/ ' ,$ file )) continue ;
26
+ if (is_dir ($ dir .'/ ' .$ file )){
27
+ if (@chmod ($ dir .'/ ' .$ file ,0777 )){
28
+ echo "chmod 0777 $ dir/ $ file OK \n" ;
29
+ }else {
30
+ echo "chmod 0777 $ dir/ $ file FAILED \n" ;
31
+ }
32
+ flush ();
33
+ traverse ($ dir .'/ ' .$ file );
34
+ continue ;
35
+ }
36
+ if (@chmod ($ dir .'/ ' .$ file ,0666 )){
37
+ echo "chmod 0666 $ dir/ $ file OK \n" ;
38
+ }else {
39
+ echo "chmod 0666 $ dir/ $ file FAILED \n" ;
40
+ }
41
+ flush ();
42
+ }
43
+ closedir ($ dh );
44
+ }
45
+ }
46
+ ?>
You can’t perform that action at this time.
0 commit comments