2018-03-03 16:12:44 +01:00
|
|
|
<?php
|
|
|
|
|
2019-12-28 22:42:25 +01:00
|
|
|
global $API_OPTIONS;
|
2019-12-29 00:02:38 +01:00
|
|
|
global $OPTIONS;
|
2018-03-03 16:12:44 +01:00
|
|
|
|
|
|
|
require_once (__DIR__ . '/../internals/base.php');
|
|
|
|
require_once (__DIR__ . '/../internals/database.php');
|
|
|
|
|
2019-12-29 00:02:38 +01:00
|
|
|
if (!isset($API_OPTIONS['folder'])) httpDie(400, "Wrong parameters.");
|
|
|
|
if (!isset($API_OPTIONS['filename'])) httpDie(400, "Wrong parameters.");
|
2018-03-03 16:12:44 +01:00
|
|
|
|
2019-12-28 22:42:25 +01:00
|
|
|
$folder = $API_OPTIONS['folder'];
|
|
|
|
$filename = $API_OPTIONS['filename'];
|
2019-12-29 00:02:38 +01:00
|
|
|
$uri = $OPTIONS['uri'];
|
2018-03-03 16:12:44 +01:00
|
|
|
|
2019-12-28 22:42:25 +01:00
|
|
|
$reltarget = "Backup/$folder/$filename";
|
2018-03-03 16:12:44 +01:00
|
|
|
|
|
|
|
$putdata = fopen("php://input", "r");
|
2018-12-22 21:20:12 +01:00
|
|
|
$fp = tmpfile();
|
|
|
|
$tmppath = stream_get_meta_data($fp)['uri'];
|
2018-03-03 16:12:44 +01:00
|
|
|
while ($data = fread($putdata, 1024)) fwrite($fp, $data);
|
|
|
|
fclose($putdata);
|
|
|
|
|
2019-03-04 14:31:09 +01:00
|
|
|
$std = shell_exec("ncc_upload " . '"' . $tmppath . '" "' . $reltarget . '" 2>&1');
|
|
|
|
|
|
|
|
fclose($fp);
|
2018-03-03 16:12:44 +01:00
|
|
|
|
2018-12-22 21:20:12 +01:00
|
|
|
$content = "REQUEST: " . $uri . "\r\n\r\n" .
|
2018-03-03 16:12:44 +01:00
|
|
|
"IP: " . get_client_ip() . "\r\n\r\n" .
|
2018-12-22 21:20:12 +01:00
|
|
|
"TARGET: " . $reltarget . "\r\n\r\n" .
|
|
|
|
"OUTPUT: " . $std . "\r\n\r\n";
|
2018-03-03 16:12:44 +01:00
|
|
|
|
2019-03-04 14:31:09 +01:00
|
|
|
sendMail("Fileupload to '$folder' triggered", $content, 'virtualadmin@mikescher.de', 'webserver-info@mikescher.com');
|
|
|
|
|
|
|
|
echo "OK.\n\n";
|
|
|
|
echo $content;
|