This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, version 3 of the License. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details. You should have received a copy of the GNU Affero General Public License along with this program. If not, see . */ include_once("../include/functions.html"); $payload = urldecode($_POST["payload"]); $filesize = strlen($payload); if (strlen($payload) > 4096) { http_response_code(413); exit; } if (! base64_decode($payload, true)) { http_response_code(400); exit; } $md5 = md5($_POST["payload"]); $sha1 = sha1($_POST["payload"]); $filename = "ecryptfs.tar.gz"; $auth = rand() . rand(); $resultset = pg_query($CONN, " insert into payload ( filename, filesize, md5, sha1, payload, auth ) values ( '" . pg_escape_string($filename) . "', '" . pg_escape_string($filesize) . "', '" . pg_escape_string($md5) . "', '" . pg_escape_string($sha1) . "', '" . pg_escape_string($payload) . "', '" . pg_escape_string($auth) . "' ) returning id "); if (pg_num_rows($resultset) == 1) { $result = pg_fetch_object($resultset, 0); if ($result->id > 0) { print($URL . "/upload/go/?u=$md5-$auth"); } } ?>