-
Notifications
You must be signed in to change notification settings - Fork 0
/
_.php
62 lines (53 loc) · 1.54 KB
/
_.php
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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
<?php
$debug = false;
if ($debug) echo "<br>";
$action = $_GET['action'];
if ($debug) echo "action=$action<br>";
$file = $_GET['file'];
if ($debug) echo "file=$file<br>";
$url = $_GET['url'];
if ($debug) echo "url=$url<br>";
$cd_dir_command = "cd /home/data/httpd/download.eclipse.org/justj/" . ($file == '.' ? '' : $file);
$dirname = dirname($file);
$cd_command = "cd /home/data/httpd/download.eclipse.org/justj/" . ($dirname == '.' ? '' : $dirname);
$base_file = basename($file);
if ($action == "rmdir") {
$command = "$cd_command
rm -r $base_file
";
} else if ($action == "rm") {
$command = "$cd_command
rm $base_file
";
} else if ($action == "edit") {
$contents = file_get_contents("/localsite/download.eclipse.org/justj/$file");
$command = "$cd_command
cat > $base_file <<\"END_OF_FILE_CONTENT\"
$contents" . "END_OF_FILE_CONTENT
";
} else if ($action == "mkdir") {
$command = "$cd_dir_command
mkdir new_folder
";
} else if ($action == "new_index") {
$command = "$cd_dir_command
cat > index.php <<\"END_OF_FILE_CONTENT\"
<?php header(\"Location: /justj/www/download.eclipse.org.php?file=$file\");?>
END_OF_FILE_CONTENT
";
} else if ($action == "new") {
$command = "$cd_dir_command
cat > new_file <<\"END_OF_FILE_CONTENT\"
END_OF_FILE_CONTENT
";
}
if ($command != "") {
$command = preg_replace("%\r%", '', $command);
if ($debug) echo "command='<pre>$command</pre>'<br>";
$encodedCommand = urlencode($command);
$fullURL = "$url$encodedCommand";
if ($debug) echo "<a href='$fullURL'>$fullURL</a><br>";
header("Location: $fullURL");
exit;
}
?>