32 lines
1.1 KiB
PHP
32 lines
1.1 KiB
PHP
<?php
|
|
# I recommend you use HTTPS and Basic access authentication to protect this file.
|
|
$locale = 'en_US.utf-8';
|
|
setlocale(LC_ALL, $locale);
|
|
putenv('LC_ALL='.$locale);
|
|
|
|
$method = $_SERVER['REQUEST_METHOD'];
|
|
switch ($method) {
|
|
case 'POST':
|
|
$input = isset($_POST['files'])?$_POST['files']:"";
|
|
if (strlen($_POST['files'])!=0) {
|
|
$files = explode("\n", str_replace("\r", "", $input));
|
|
echo json_encode($files, JSON_UNESCAPED_SLASHES);
|
|
#shell_exec("echo '".json_encode($files)."' >>/tmp/out.txt 2>&1 &");
|
|
foreach ($files as $file) {
|
|
shell_exec("cd /home/downloads;rm -- ".escapeshellarg($file)." >>/tmp/rm.txt 2>&1 &");
|
|
}
|
|
exit;
|
|
} else {
|
|
echo json_encode(array("error" => "empty file"));
|
|
}
|
|
break;
|
|
case 'GET':
|
|
echo '<form method="post" action="'.htmlspecialchars($_SERVER["PHP_SELF"]).'">
|
|
FILES:<br/>
|
|
<textarea name="files" rows="5" cols="50"></textarea><br/>
|
|
<input type="submit">
|
|
</form>';
|
|
break;
|
|
}
|
|
?>
|