-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathftp.php
84 lines (81 loc) · 2.91 KB
/
ftp.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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
<?php
include ("./inc/init.php");
?>
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title>Ftp</title>
<meta name="description" content="Uploader">
<meta name="author" content="Matej Teo Zilak">
</head>
<body>
<div id="container">
<header>
<h1>FTP</h1>
<p>
Commands that can be used via Uploader class for CDN browsing:
</p>
<ul>
<li>
"cd dirname" enter the directory with given name. "cd .." for dir up
</li>
<li>
"ls" list files in a dir
</li>
<li>
"mkdir dirname" make a directory
</li>
<li>
"rm filename" remove a filename - for dir removal "rm dirname/" also with ending slash
</li>
<li>
"link filename" get link to the file
</li>
</ul>
</header>
<div id="main" role="main">
<form method="post" action="ftp.php">
<input id="console" name="console" type="text" />
<input type="submit" name="go" value="go" />
</form>
</div>
<footer>
<div id="console_out">
<?php
if (isset($_POST['go'])) {
$ftp = new Uploader(0);
if (isset($_COOKIE['Uploader_dir'])) {
$ftp -> setActualDir($_COOKIE['Uploader_dir']);
}
$action_dir = explode(" ", $_POST['console']);
$method = $action_dir[0];
$dir = $action_dir[1];
switch ($method) {
case "ls" :
$ftp -> ls();
break;
case "cd" :
$ftp -> cd($dir);
break;
case "mkdir" :
$ftp -> mkdir($dir);
break;
case "rm" :
$ftp -> rm($dir);
break;
case "link" :
$ftp -> getLink($dir);
break;
default :
echo "Error";
break;
}
}
?>
</div>
</footer>
</div>
</body>
</html>