2018-03-03 16:12:44 +01:00
|
|
|
<?php
|
2020-01-16 13:21:14 +01:00
|
|
|
require_once (__DIR__ . '/../internals/website.php');
|
2018-03-03 16:12:44 +01:00
|
|
|
|
2020-01-16 13:21:14 +01:00
|
|
|
/** @var PageFrameOptions $FRAME_OPTIONS */ global $FRAME_OPTIONS;
|
|
|
|
/** @var URLRoute $ROUTE */ global $ROUTE;
|
|
|
|
/** @var Website $SITE */ global $SITE;
|
2018-03-03 16:12:44 +01:00
|
|
|
|
|
|
|
|
2020-01-16 13:21:14 +01:00
|
|
|
if (!isset($API_OPTIONS['folder'])) { $FRAME_OPTIONS->forceResult(400, "Wrong parameters."); return; }
|
|
|
|
if (!isset($API_OPTIONS['filename'])) { $FRAME_OPTIONS->forceResult(400, "Wrong parameters."); return; }
|
2018-03-03 16:12:44 +01:00
|
|
|
|
2019-12-28 22:42:25 +01:00
|
|
|
$folder = $API_OPTIONS['folder'];
|
|
|
|
$filename = $API_OPTIONS['filename'];
|
2020-01-16 13:21:14 +01:00
|
|
|
$uri = $ROUTE->full_url;
|
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
|
|
|
|
2022-10-16 15:50:38 +02:00
|
|
|
$content = "REQUEST: " . $uri . "\n\n" .
|
|
|
|
"IP: " . get_client_ip() . "\n\n" .
|
|
|
|
"TARGET: " . $reltarget . "\n\n" .
|
|
|
|
"OUTPUT: " . $std . "\n\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;
|