tinybox

Code for file upload software on up.concealed.world.
git clone git://git.concealed.world/tinybox
Log | Files | Refs | README | LICENSE

commit d0e3a97f36b613f5247af4bbe0c2fca4d7ec8def
parent d0b62125991260a65a79d0390733ca46ea064c35
Author: Nixx <nixx@firemail.cc>
Date:   Wed, 16 Feb 2022 18:44:09 +0000

Remove

Diffstat:
Dind | 102-------------------------------------------------------------------------------
Dind2 | 141-------------------------------------------------------------------------------
2 files changed, 0 insertions(+), 243 deletions(-)

diff --git a/ind b/ind @@ -1,102 +0,0 @@ -<?php -/* - Copyright (C) <2022> <nixx@firemail.cc> - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - 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 General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. -*/ - -}else{ -?> - <html> - <head> - <title>tinybox</title> - <link rel="icon" type="image/png" href="favicon.png"> - <meta name='viewport' content='width=device-width, initial-scale=1.0' /> - <style> - @font-face { - font-family: 'vga'; - src: url('/vga.woff2') format('woff2'), - url('/vga.woff') format('woff'); - } - - html { - font-family: 'vga', monospace; - background-color: #111; - color: #fff; - } - h1, h2{ - font-weight: normal !important; - } - h2 { - font-size: 1em; - text-decoration: underline; - } - a, a:link { - color: #8dc; - text-decoration: underline; - } - a:active, a:visited { color: #8fc; } - a:focus { outline: 1px dotted; } - a:hover { color: #8cd; } - </style> - </head> - <body> - <h1>tinybox<h1> - - <h2>Upload via cUrl:</h2> - <p>curl -F upload='@somefile.ext' <?php echo $url; ?></p> - - <h2>Upload via form:</h2> - <form enctype="multipart/form-data" action="index.php" method="POST"> - <input type="hidden" name="MAX_FILE_SIZE" value="<?php echo $maxsize; ?>" /> - <input type="file" name="upload" /> - <input type="submit" value="Upload" /> - </form> - - <pre> - ___ - .~.----\ - /.' .^. - |/ ___..' \ ____----____ - |.--'' ;' .--~~~~ ' - .-' ''-. - .' '-. - / .^. | '- - . . / | | . \'-. \ - ' ; / | ;\ | \ '-'. -; . . / | / \ | ' \ ' -. ; |/ ; / \| . ; - ; . .' . / ; ; | ' - ; | ; |.' | | . |\ ; - . .| . %%%%% / %%%% ; | ; . '.| - ;( | | . |. ; ; \ - | \| | * ) |' ;/ - | | |. `-^-' .' | ' - | | .'-._ _.-' | | - | | ;.- | ~~~' | ; | - ; ' ; \ |-. ' ; - ' ; \ '. / \. . - ' . \ '-../ ' ; - | \ \ / | - </pre> - - <p>* Max filesize of 12 MB.<br /> - * The files' longevity is not guaranteed.</p> - - <p><a href="https://git.concealed.world/tinybox/files.html" target="_blank">Git Repository</a> <a href="http://opxr3vfzliykjbkqf6uvvmagscsc77iyq5xe6dglnh63yip4b7zkhpqd.onion/tinybox/files.html" target="_blank">(onion)</a></p> - </body> - </html> -<?php -} -?> diff --git a/ind2 b/ind2 @@ -1,141 +0,0 @@ -<?php -/* - Copyright (C) <2022> <nixx@firemail.cc> - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - 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 General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. -*/ - -$destdir = "/file/"; -$maxsize = 12 * 1024 * 1024; // 12 MB - -$protocol = ((!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] != 'off') || $_SERVER['SERVER_PORT'] == 443) ? "https://" : "http://"; -$url = $protocol.$_SERVER['HTTP_HOST']; - -if($_FILES){ - $origname = $_FILES['upload']['name']; - $mtime = sprintf('%.6f', microtime(true)); - $name = substr($mtime, 0, 10) . substr($mtime, 11); - $extpos = strripos($origname, '.'); - if($extpos){ - $ext = strtolower(substr($origname, $extpos + 1)); - $name = $name.".".$ext; - } - - if($_FILES['upload']['size'] > $maxsize){ - exit("ERR: Filesize too large.\n"); - } - - $tmpfile = $_FILES['upload']['tmp_name']; - $isimage = getimagesize($tmpfile) ? true : false; - - if($isimage){ - $img = new Imagick(realpath($tmpfile)); - $profile = $img->getImageProfiles("icc", true); - $img->stripImage(); - if(!empty($profile)) $img->profileImage("icc", $profile['icc']); - $img->writeImage($tmpfile); - $img->clear(); - $img->destroy(); - } - - if(move_uploaded_file($tmpfile, getcwd().$destdir.$name)){ - echo $url.$destdir.$name."\n"; - echo "<br /><a href='".$url.$destdir.$name."'>[Link]</a><br />\n"; - }else{ - exit("ERR: Upload failed. Error code '".$_FILES['upload']['error']."'.\n"); - } -}else{ -?> - <html> - <head> - <title>tinybox</title> - <link rel="icon" type="image/png" href="favicon.png"> - <meta name='viewport' content='width=device-width, initial-scale=1.0' /> - <style> - @font-face { - font-family: 'vga'; - src: url('/vga.woff2') format('woff2'), - url('/vga.woff') format('woff'); - } - - html { - font-family: 'vga', monospace; - background-color: #111; - color: #fff; - } - h1, h2{ - font-weight: normal !important; - } - h2 { - font-size: 1em; - text-decoration: underline; - } - a, a:link { - color: #8dc; - text-decoration: underline; - } - a:active, a:visited { color: #8fc; } - a:focus { outline: 1px dotted; } - a:hover { color: #8cd; } - </style> - </head> - <body> - <h1>tinybox<h1> - - <h2>Upload via cUrl:</h2> - <p>curl -F upload='@somefile.ext' <?php echo $url; ?></p> - - <h2>Upload via form:</h2> - <form enctype="multipart/form-data" action="index.php" method="POST"> - <input type="hidden" name="MAX_FILE_SIZE" value="<?php echo $maxsize; ?>" /> - <input type="file" name="upload" /> - <input type="submit" value="Upload" /> - </form> - - <pre> - ___ - .~.----\ - /.' .^. - |/ ___..' \ ____----____ - |.--'' ;' .--~~~~ ' - .-' ''-. - .' '-. - / .^. | '- - . . / | | . \'-. \ - ' ; / | ;\ | \ '-'. -; . . / | / \ | ' \ ' -. ; |/ ; / \| . ; - ; . .' . / ; ; | ' - ; | ; |.' | | . |\ ; - . .| . %%%%% / %%%% ; | ; . '.| - ;( | | . |. ; ; \ - | \| | * ) |' ;/ - | | |. `-^-' .' | ' - | | .'-._ _.-' | | - | | ;.- | ~~~' | ; | - ; ' ; \ |-. ' ; - ' ; \ '. / \. . - ' . \ '-../ ' ; - | \ \ / | - </pre> - - <p>* Max filesize of 12 MB.<br /> - * The files' longevity is not guaranteed.</p> - - <p><a href="https://git.concealed.world/tinybox/files.html" target="_blank">Git Repository</a> <a href="http://opxr3vfzliykjbkqf6uvvmagscsc77iyq5xe6dglnh63yip4b7zkhpqd.onion/tinybox/files.html" target="_blank">(onion)</a></p> - </body> - </html> -<?php -} -?>