2023-09-28 21:29:21 +02:00
|
|
|
<?php
|
|
|
|
/* curload
|
|
|
|
* Simple file uploading using POST requests and temporary keys
|
|
|
|
* Licensed under the GNU Affero General Public License version 3.0
|
|
|
|
*/
|
|
|
|
|
2023-09-30 20:31:01 +02:00
|
|
|
function main() {
|
|
|
|
include "config.php";
|
|
|
|
include "core.php";
|
2023-09-29 21:29:29 +02:00
|
|
|
|
2023-10-01 03:47:59 +02:00
|
|
|
$Error = "";
|
2023-09-30 20:31:01 +02:00
|
|
|
$html = "";
|
2023-10-01 03:47:59 +02:00
|
|
|
|
2023-09-30 22:24:02 +02:00
|
|
|
$html = printHeader($html);
|
2023-09-29 21:29:29 +02:00
|
|
|
|
2023-10-01 03:47:59 +02:00
|
|
|
$html .= "\t\t\t<h1>$instanceName</h1>\n";
|
2023-10-01 04:03:42 +02:00
|
|
|
$html .= "\t\t\t\t<p>$instanceDescription</p>\n";
|
2023-10-01 03:47:59 +02:00
|
|
|
|
|
|
|
if (isset($_REQUEST['e'])) {
|
|
|
|
$Error = $_REQUEST['e'];
|
|
|
|
}
|
|
|
|
|
2023-10-01 16:23:07 +02:00
|
|
|
if (isset($_COOKIE[$cookieTypeName]) || ($publicUploading || $publicUploading == "true")) {
|
2023-10-01 03:47:59 +02:00
|
|
|
$html .= "\t\t\t<form action=\"upload.php\" method=\"post\" enctype=\"multipart/form-data\">\n";
|
|
|
|
$html .= "\t\t\t\t<input type=\"file\" name=\"file\" id=\"file\">\n";
|
|
|
|
$html .= "\t\t\t\t<input type=\"submit\" value=\"Upload selected file\" name=\"web\">\n";
|
|
|
|
$html .= "\t\t\t</form>\n";
|
|
|
|
$html .= "\t\t\t<p>Max file size: $maxFileSize MB</p>\n";
|
|
|
|
|
|
|
|
// error handling
|
|
|
|
if ($Error == "file") {
|
|
|
|
$html .= "\t\t\t<p class=\"error\">No file specified.</p>\n";
|
|
|
|
} else if ($Error == "size") {
|
|
|
|
$html .= "\t\t\t<p class=\"error\">File is too big.</p>\n";
|
|
|
|
} else if ($Error == "key") {
|
|
|
|
$html .= "\t\t\t<p class=\"error\">Invalid key. WTF?</p>\n";
|
|
|
|
} else if ($Error == "wtf") {
|
|
|
|
$html .= "\t\t\t<p class=\"error\">WTF? Try again.</p>\n";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-09-30 20:31:01 +02:00
|
|
|
$html = printFooter($html);
|
2023-09-29 21:29:29 +02:00
|
|
|
|
2023-09-30 20:31:01 +02:00
|
|
|
print "$html";
|
|
|
|
}
|
|
|
|
|
|
|
|
main();
|
2023-09-28 21:29:21 +02:00
|
|
|
|
|
|
|
?>
|