From: Emil Williams Date: Thu, 17 Apr 2025 09:22:57 +0000 (-0600) Subject: Hail satan X-Git-Url: https://git.xolatile.top/?a=commitdiff_plain;h=208e0da00dd54ff408322caa19fc4d8265301c67;p=emil-chud.cyou.git Hail satan img -- -- rm rm -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- fuck lfs, it really sucks -- -- -- -- -- -- -- -- -- -- -- -- daata -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --- diff --git a/.gitattributes b/.gitattributes deleted file mode 100644 index ebefba9..0000000 --- a/.gitattributes +++ /dev/null @@ -1,2 +0,0 @@ -*.avif filter=lfs diff=lfs merge=lfs -text -*.png filter=lfs diff=lfs merge=lfs -text diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..a17fa96 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +help.html diff --git a/404.html b/404.html index 15fbc42..3a17ce5 100644 --- a/404.html +++ b/404.html @@ -1,15 +1,15 @@ - - + + - + diff --git a/css/style.css b/css/style.css index b6f961a..5e380b5 100644 --- a/css/style.css +++ b/css/style.css @@ -8,9 +8,6 @@ padding-left: 5em; p, div { padding: 0em 2em 0em 2em; } -body { -background: url(/img/flowers.png) repeat 0 0; -} a:link { color: blue; text-decoration: none; diff --git a/help.html b/help.html deleted file mode 100644 index f24c152..0000000 --- a/help.html +++ /dev/null @@ -1,45 +0,0 @@ - - - - Sopel Help - - - - -

Sopel Help

-

ADMIN

-

ADMINCHANNEL

-

ANNOUNCE

-

CALC

-

CHOOSE

-

CLOCK

-

CORETASKS

-

COUNTDOWN

-

CURRENCY

-

DICE

-

EMOTICONS

-

HELP

-

INVITE

-

ISUP

-

LMGTFY

-

PING

-

PRONOUNS

-

RAND

-

RELOAD

-

SAFETY

-
-

SEEN

-

TELL

-

TLD

-

TRANSLATE

-

UNICODE_INFO

-

UNITS

-

UPTIME

-

URL

-

VERSION

-

WIKIPEDIA

-

WIKTIONARY

-

XKCD

- - - \ No newline at end of file diff --git a/home.html b/home.html index e2ee525..4ac2d4a 100644 --- a/home.html +++ b/home.html @@ -33,13 +33,14 @@

- - - - - - - - - - - - - ChudHome - - - - - - - - - - - -

-
+
> If only you knew how bad things really were

[C] LibDill
[C] Bestline
[C] Some Were Meant
[Fun] CERN
+
[Fun] 10-code
[Fun] PDP-8
[Fun] cube.sed
[Fun] Ternary
@@ -53,42 +54,79 @@
[Web] begone oauth2
[People] someodd
[People] c353
+
NEVER trust LFS
+
[Servers] Advin
+
[Servers] Contabo
+
[Buy] Disk Prices
+
[India] Ban India
+
[HTTP/3] Cloudflare QUIC
+
[DNS] Porky

-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+

It's
Peak Web Design

- +

Copyright?

It's free - as long as you don't value your time, idiot.

diff --git a/img/10641606944612965.avif b/img/10641606944612965.avif new file mode 100755 index 0000000..728f0f0 Binary files /dev/null and b/img/10641606944612965.avif differ diff --git a/img/1106$chadpanik.avif b/img/1106$chadpanik.avif new file mode 100755 index 0000000..9cf0be8 Binary files /dev/null and b/img/1106$chadpanik.avif differ diff --git a/img/110rage.avif b/img/110rage.avif new file mode 100755 index 0000000..c0f8d87 Binary files /dev/null and b/img/110rage.avif differ diff --git a/img/113question.avif b/img/113question.avif new file mode 100755 index 0000000..7a0e8b4 Binary files /dev/null and b/img/113question.avif differ diff --git a/img/129pepe.avif b/img/129pepe.avif new file mode 100755 index 0000000..df12301 Binary files /dev/null and b/img/129pepe.avif differ diff --git a/img/134ownnothingbehappy.avif b/img/134ownnothingbehappy.avif new file mode 100755 index 0000000..93c76de Binary files /dev/null and b/img/134ownnothingbehappy.avif differ diff --git a/img/139old.avif b/img/139old.avif new file mode 100755 index 0000000..f2960b9 Binary files /dev/null and b/img/139old.avif differ diff --git a/img/141ohhh.avif b/img/141ohhh.avif new file mode 100755 index 0000000..3a94312 Binary files /dev/null and b/img/141ohhh.avif differ diff --git a/img/142ocd.avif b/img/142ocd.avif new file mode 100755 index 0000000..c8fd068 Binary files /dev/null and b/img/142ocd.avif differ diff --git a/img/1743154712513091.jpg b/img/1743154712513091.jpg new file mode 100644 index 0000000..92c960f Binary files /dev/null and b/img/1743154712513091.jpg differ diff --git a/img/1743192834675151.png b/img/1743192834675151.png new file mode 100644 index 0000000..110a2f6 Binary files /dev/null and b/img/1743192834675151.png differ diff --git a/img/1743194410174259.jpg b/img/1743194410174259.jpg new file mode 100644 index 0000000..6818040 Binary files /dev/null and b/img/1743194410174259.jpg differ diff --git a/img/1743270609737517.jpg b/img/1743270609737517.jpg new file mode 100644 index 0000000..6ca9db3 Binary files /dev/null and b/img/1743270609737517.jpg differ diff --git a/img/1743362761778059.jpg b/img/1743362761778059.jpg new file mode 100644 index 0000000..db23b92 Binary files /dev/null and b/img/1743362761778059.jpg differ diff --git a/img/174meirl2.avif b/img/174meirl2.avif new file mode 100755 index 0000000..9457b63 Binary files /dev/null and b/img/174meirl2.avif differ diff --git a/img/178master_of_nothing.avif b/img/178master_of_nothing.avif new file mode 100755 index 0000000..51fc267 Binary files /dev/null and b/img/178master_of_nothing.avif differ diff --git a/img/194lindypistol.avif b/img/194lindypistol.avif new file mode 100755 index 0000000..69e20f2 Binary files /dev/null and b/img/194lindypistol.avif differ diff --git a/img/203laravel_user.avif b/img/203laravel_user.avif new file mode 100755 index 0000000..8bc670e Binary files /dev/null and b/img/203laravel_user.avif differ diff --git a/img/214lagh.gif b/img/214lagh.gif new file mode 100755 index 0000000..ca2098c Binary files /dev/null and b/img/214lagh.gif differ diff --git a/img/215kubra.avif b/img/215kubra.avif new file mode 100755 index 0000000..1387c3f Binary files /dev/null and b/img/215kubra.avif differ diff --git a/img/222joke.avif b/img/222joke.avif new file mode 100755 index 0000000..2c018d9 Binary files /dev/null and b/img/222joke.avif differ diff --git a/img/226jestlain.avif b/img/226jestlain.avif new file mode 100755 index 0000000..3103fb4 Binary files /dev/null and b/img/226jestlain.avif differ diff --git a/img/235it's.avif b/img/235it's.avif new file mode 100755 index 0000000..1a65e21 Binary files /dev/null and b/img/235it's.avif differ diff --git a/img/237inb4.avif b/img/237inb4.avif new file mode 100755 index 0000000..d3e8f4a Binary files /dev/null and b/img/237inb4.avif differ diff --git a/img/261gnu.avif b/img/261gnu.avif new file mode 100755 index 0000000..7f75037 Binary files /dev/null and b/img/261gnu.avif differ diff --git a/img/262glowie.avif b/img/262glowie.avif new file mode 100755 index 0000000..eff97ef Binary files /dev/null and b/img/262glowie.avif differ diff --git a/img/269gentolmen.avif b/img/269gentolmen.avif new file mode 100755 index 0000000..b71b328 Binary files /dev/null and b/img/269gentolmen.avif differ diff --git a/img/270gentlemen.avif b/img/270gentlemen.avif new file mode 100755 index 0000000..66c8316 Binary files /dev/null and b/img/270gentlemen.avif differ diff --git a/img/278frogcels.gif b/img/278frogcels.gif new file mode 100755 index 0000000..b67931d Binary files /dev/null and b/img/278frogcels.gif differ diff --git a/img/292factpepe.avif b/img/292factpepe.avif new file mode 100755 index 0000000..56e876e Binary files /dev/null and b/img/292factpepe.avif differ diff --git a/img/294example.avif b/img/294example.avif new file mode 100755 index 0000000..04a83f3 Binary files /dev/null and b/img/294example.avif differ diff --git a/img/301emacjihad.avif b/img/301emacjihad.avif new file mode 100755 index 0000000..027cdd0 Binary files /dev/null and b/img/301emacjihad.avif differ diff --git a/img/318downchang.avif b/img/318downchang.avif new file mode 100755 index 0000000..4ddecc8 Binary files /dev/null and b/img/318downchang.avif differ diff --git a/img/356chuder.avif b/img/356chuder.avif new file mode 100755 index 0000000..a3c3795 Binary files /dev/null and b/img/356chuder.avif differ diff --git a/img/357chudchad.avif b/img/357chudchad.avif new file mode 100755 index 0000000..1e7a392 Binary files /dev/null and b/img/357chudchad.avif differ diff --git a/img/447aftermath.avif b/img/447aftermath.avif new file mode 100755 index 0000000..dd31228 Binary files /dev/null and b/img/447aftermath.avif differ diff --git a/img/537ITSOVERSHINJI.avif b/img/537ITSOVERSHINJI.avif new file mode 100755 index 0000000..a9ca640 Binary files /dev/null and b/img/537ITSOVERSHINJI.avif differ diff --git a/img/543IMCOOOMMMMMMMMPILLLLING.avif b/img/543IMCOOOMMMMMMMMPILLLLING.avif new file mode 100755 index 0000000..b839054 Binary files /dev/null and b/img/543IMCOOOMMMMMMMMPILLLLING.avif differ diff --git a/img/593AAAAAAAAAAAA.avif b/img/593AAAAAAAAAAAA.avif new file mode 100755 index 0000000..e864b0f Binary files /dev/null and b/img/593AAAAAAAAAAAA.avif differ diff --git a/img/604782vaq.avif b/img/604782vaq.avif new file mode 100755 index 0000000..7b0efd0 Binary files /dev/null and b/img/604782vaq.avif differ diff --git a/img/6223letglow.avif b/img/6223letglow.avif new file mode 100755 index 0000000..04a63db Binary files /dev/null and b/img/6223letglow.avif differ diff --git a/img/6292a6aac4391a872929c7c5723e5e493db.avif b/img/6292a6aac4391a872929c7c5723e5e493db.avif new file mode 100755 index 0000000..5ee1b96 Binary files /dev/null and b/img/6292a6aac4391a872929c7c5723e5e493db.avif differ diff --git a/img/6342607-24108-12807.avif b/img/6342607-24108-12807.avif new file mode 100755 index 0000000..527bb34 Binary files /dev/null and b/img/6342607-24108-12807.avif differ diff --git a/img/64820445-19965-66.avif b/img/64820445-19965-66.avif new file mode 100755 index 0000000..09dd25f Binary files /dev/null and b/img/64820445-19965-66.avif differ diff --git a/img/665172073521242067.avif b/img/665172073521242067.avif new file mode 100755 index 0000000..cad3556 Binary files /dev/null and b/img/665172073521242067.avif differ diff --git a/img/6751712383973534a.gif b/img/6751712383973534a.gif new file mode 100755 index 0000000..dbe1273 Binary files /dev/null and b/img/6751712383973534a.gif differ diff --git a/img/6771711576511290336.avif b/img/6771711576511290336.avif new file mode 100755 index 0000000..acf84c2 Binary files /dev/null and b/img/6771711576511290336.avif differ diff --git a/img/6891709318435493132.avif b/img/6891709318435493132.avif new file mode 100755 index 0000000..6ce3ba4 Binary files /dev/null and b/img/6891709318435493132.avif differ diff --git a/img/7011706171717962026.avif b/img/7011706171717962026.avif new file mode 100755 index 0000000..3ac127c Binary files /dev/null and b/img/7011706171717962026.avif differ diff --git a/img/7191699463219093145.avif b/img/7191699463219093145.avif new file mode 100755 index 0000000..398331f Binary files /dev/null and b/img/7191699463219093145.avif differ diff --git a/img/7531684757913922057.avif b/img/7531684757913922057.avif new file mode 100755 index 0000000..964c1e0 Binary files /dev/null and b/img/7531684757913922057.avif differ diff --git a/img/98reeeeee.gif b/img/98reeeeee.gif new file mode 100755 index 0000000..86be8c0 Binary files /dev/null and b/img/98reeeeee.gif differ diff --git a/img/Off To Hang Myself.webm b/img/Off To Hang Myself.webm new file mode 100644 index 0000000..efe0545 Binary files /dev/null and b/img/Off To Hang Myself.webm differ diff --git a/img/chuddies/416bell.avif b/img/chuddies/416bell.avif new file mode 100755 index 0000000..1a50a28 Binary files /dev/null and b/img/chuddies/416bell.avif differ diff --git a/img/chuddies/billions_must_local.png b/img/chuddies/billions_must_local.png new file mode 100644 index 0000000..07a13bb Binary files /dev/null and b/img/chuddies/billions_must_local.png differ diff --git a/img/chuddies/chud1.jpg b/img/chuddies/chud1.jpg new file mode 100644 index 0000000..3cfef90 Binary files /dev/null and b/img/chuddies/chud1.jpg differ diff --git a/img/chuddies/chud10.png b/img/chuddies/chud10.png new file mode 100644 index 0000000..36361c8 Binary files /dev/null and b/img/chuddies/chud10.png differ diff --git a/img/chuddies/chud11.png b/img/chuddies/chud11.png new file mode 100644 index 0000000..ebd6dd4 Binary files /dev/null and b/img/chuddies/chud11.png differ diff --git a/img/chuddies/chud2.jpg b/img/chuddies/chud2.jpg new file mode 100644 index 0000000..1bfdb8d Binary files /dev/null and b/img/chuddies/chud2.jpg differ diff --git a/img/chuddies/chud3.png b/img/chuddies/chud3.png new file mode 100644 index 0000000..cf70b9d Binary files /dev/null and b/img/chuddies/chud3.png differ diff --git a/img/chuddies/chud4.png b/img/chuddies/chud4.png new file mode 100644 index 0000000..45e8349 Binary files /dev/null and b/img/chuddies/chud4.png differ diff --git a/img/chuddies/chud5.png b/img/chuddies/chud5.png new file mode 100644 index 0000000..ee8f14a Binary files /dev/null and b/img/chuddies/chud5.png differ diff --git a/img/chuddies/chud6.png b/img/chuddies/chud6.png new file mode 100644 index 0000000..893f959 Binary files /dev/null and b/img/chuddies/chud6.png differ diff --git a/img/chuddies/chud7.png b/img/chuddies/chud7.png new file mode 100644 index 0000000..1023c16 Binary files /dev/null and b/img/chuddies/chud7.png differ diff --git a/img/chuddies/chud8.png b/img/chuddies/chud8.png new file mode 100644 index 0000000..2460854 Binary files /dev/null and b/img/chuddies/chud8.png differ diff --git a/img/chuddies/chud9.png b/img/chuddies/chud9.png new file mode 100644 index 0000000..6c0576c Binary files /dev/null and b/img/chuddies/chud9.png differ diff --git a/img/chuddies/dguiu.jpg b/img/chuddies/dguiu.jpg new file mode 100644 index 0000000..7a10b0f Binary files /dev/null and b/img/chuddies/dguiu.jpg differ diff --git a/img/favicon.png b/img/favicon.png new file mode 100644 index 0000000..b79f13f --- /dev/null +++ b/img/favicon.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:c3f78ab09e787781ca66526a087fb42747e9917f3bc253ff5a2f29a839726750 +size 1783 diff --git a/img/monero.png b/img/monero.png new file mode 100644 index 0000000..cc83a08 Binary files /dev/null and b/img/monero.png differ diff --git a/img/readingcomprehension.avif b/img/readingcomprehension.avif new file mode 100755 index 0000000..e76ebf8 Binary files /dev/null and b/img/readingcomprehension.avif differ diff --git a/img/resum.jpg b/img/resum.jpg new file mode 100644 index 0000000..4dc6f55 Binary files /dev/null and b/img/resum.jpg differ diff --git a/img/shanji.avif b/img/shanji.avif new file mode 100755 index 0000000..8cec5a0 Binary files /dev/null and b/img/shanji.avif differ diff --git a/img/short.avif b/img/short.avif new file mode 100755 index 0000000..bc27531 Binary files /dev/null and b/img/short.avif differ diff --git a/img/theybought$rddt.avif b/img/theybought$rddt.avif new file mode 100755 index 0000000..d4aa24b Binary files /dev/null and b/img/theybought$rddt.avif differ diff --git a/img/uwuzrite.avif b/img/uwuzrite.avif new file mode 100755 index 0000000..5be84b9 Binary files /dev/null and b/img/uwuzrite.avif differ diff --git a/img/xolat.png b/img/xolat.png new file mode 100644 index 0000000..60de5a4 Binary files /dev/null and b/img/xolat.png differ diff --git a/index.html b/index.html index e3e6d1d..a3c03c1 100644 --- a/index.html +++ b/index.html @@ -24,26 +24,24 @@ UpChud | Home | Weather | - - Exit


You're Illegally in ✶Chud Airspace✶

Get the fuck out

- - - -
- - -
- - -
+ + +
+ + +
+ + +

I fucking LOVE avif

+

I fucking HATE Git LFS


We will forsake our countries, we will leave our mother lands behind us, and become one with CHUDness.

We have no nation, no philosophy, no ideology, and no bitches.

@@ -56,34 +54,29 @@

I demand FREE SHEKELS
for buying the dip of INTC
and paying back the fines I keep getting from the German government

-

XMR

- +

monero:89YhoqxStExKtzQJh119MULDWqGr8WBspLFp9X34KyEacdK8Y2zaWHVeQoR1UpPqxoTzxxGpPiLm374xtstMrJ3TGTgFV3V"

+

Current Balance:

-( $55.77 + ${jewish_student_loan} + ${bail} + ${credit_card_interest} + ${inherited_dept} + ${court_fees} + ${crack_dept} + ${what_i_own_to_the_jewish_mob} + ${what_i_own_to_the_german_trannies} + ${powdered_milk_for_wifes_boyfriends_baby[0-3]} ) +( $55.77 + ${jewish_student_loan} + ${bail} + ${credit_card_interest} + ${inherited_dept} + ${court_fees} + ${crack_dept} + ${what_i_own_to_the_jewish_mob} + ${what_i_own_to_the_german_trannies} + ${powdered_milk_for_wifes_boyfriends_baby[0-3]} + ${paying_lfs_damages} )

(that's negative if you didn't notice)

CHUD.CYOU was created by this internationally wanted chud

- +
"I fucking hate <The Web> so much it's unreal"
- Email , 79 AH
+
"I fucking hate <Git LFS> so much it's unreal"
- Lime , 79 AH

Emil me about your lady-like concerns.

1 BILLION YEARS of torture will be admitted to copyright ignorers

Just kidding, all shit on this website is Public Domain, except this sentence

- - - - - - diff --git a/sitemap.xml b/sitemap.xml deleted file mode 100644 index 9f7b8f7..0000000 --- a/sitemap.xml +++ /dev/null @@ -1,27 +0,0 @@ - - - - - - - https://chud.cyou/ - 2025-04-09T00:19:46+00:00 - 1.00 - - - https://chud.cyou/irc.html - 2025-04-10T03:05:26+00:00 - 0.80 - - - https://chud.cyou/home.html - 2025-04-09T00:17:38+00:00 - 0.80 - - - - \ No newline at end of file diff --git a/temp b/temp new file mode 100644 index 0000000..e69de29 diff --git a/up/.gitignore b/up/.gitignore new file mode 100644 index 0000000..d98583c --- /dev/null +++ b/up/.gitignore @@ -0,0 +1 @@ +/load diff --git a/up/aliases b/up/aliases new file mode 100644 index 0000000..6242f11 --- /dev/null +++ b/up/aliases @@ -0,0 +1,18 @@ +# I am bash, bourne of pure evil +upload(){ + url="$1" + shift + for i in "$@"; do + curl "$url" -F"file=@$i" + done +} +lainsafe(){ upload "https://lainsafe.kalli.st/" "$@" ; echo ; } +0x0(){ upload "https://0x0.st/" "$@" ; } +x0(){ upload "https://x0.at/" "$@" ; } +chud(){ upload "https://up.chud.cyou/" "$@" ; } +random(){ + # chud omitted due to low allocated MiB and limited suffixes + l=("lainsafe" "0x0" "x0") + j=${l[$(($RANDOM % ${#l[@]}))]} + "$j" "$@" +} diff --git a/up/index.php b/up/index.php new file mode 100755 index 0000000..f2b9a2c --- /dev/null +++ b/up/index.php @@ -0,0 +1,454 @@ + true, + 'h' => true, + 'm4' => true, + 'md' => true, + 'org' => true, + 'txt' => true, + 'gpg' => true, + 'pdf' => true, + 'avif' => true, + 'jpeg' => true, + 'jpg' => true, + 'png' => true, + 'jxl' => true, + 'gif' => true, + 'mkv' => true, + 'mp4' => true, + 'webm' => true +); + const LIMIT_EXT = true; // to enable the usage of the above + + const FORCE_HTTPS = true; //force generated links to be https:// + + const ADMIN_EMAIL = 'admin@chud.cyou'; //address for inquiries + + public static function SITE_URL() : string + { + $proto = ($_SERVER['HTTPS'] ?? 'off') == 'on' || CONFIG::FORCE_HTTPS ? 'https' : 'http'; + return "$proto://up.{$_SERVER['HTTP_HOST']}"; + } + + public static function SCRIPT_URL() : string + { + return CONFIG::SITE_URL().$_SERVER['REQUEST_URI']; + } +}; + + +// generate a random string of characters with given length +function rnd_str(int $len) : string +{ + $chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_'; + $max_idx = strlen($chars) - 1; + $out = ''; + while ($len--) + { + $out .= $chars[mt_rand(0,$max_idx)]; + } + return $out; +} + +// check php.ini settings and print warnings if anything's not configured properly +function check_config() : void +{ + return; + $warn_config_value = function($ini_name, $var_name, $var_val) + { + $ini_val = intval(ini_get($ini_name)); + if ($ini_val < $var_val) + print("
Warning: php.ini: $ini_name ($ini_val) set lower than $var_name ($var_val)\n
"); + }; + + $warn_config_value('upload_max_filesize', 'MAX_FILESIZE', CONFIG::MAX_FILESIZE); + $warn_config_value('post_max_size', 'MAX_FILESIZE', CONFIG::MAX_FILESIZE); + $warn_config_value('max_input_time', 'UPLOAD_TIMEOUT', CONFIG::UPLOAD_TIMEOUT); + $warn_config_value('max_execution_time', 'UPLOAD_TIMEOUT', CONFIG::UPLOAD_TIMEOUT); +} + +//extract extension from a path (does not include the dot) +function ext_by_path(string $path) : string +{ + $ext = pathinfo($path, PATHINFO_EXTENSION); + //special handling of .tar.* archives + $ext2 = pathinfo(substr($path,0,-(strlen($ext)+1)), PATHINFO_EXTENSION); + if ($ext2 === 'tar') + { + $ext = $ext2.'.'.$ext; + } + return $ext; +} + +function ext_by_finfo(string $path) : string +{ + $finfo = finfo_open(FILEINFO_EXTENSION); + $finfo_ext = finfo_file($finfo, $path); + finfo_close($finfo); + if ($finfo_ext != '???') + { + return explode('/', $finfo_ext, 2)[0]; + } + else + { + $finfo = finfo_open(); + $finfo_info = finfo_file($finfo, $path); + finfo_close($finfo); + if (strstr($finfo_info, 'text') !== false) + { + return 'txt'; + } + } + return ''; +} + +// store an uploaded file, given its name and temporary path (e.g. values straight out of $_FILES) +// files are stored wit a randomised name, but with their original extension +// +// $name: original filename +// $tmpfile: temporary path of uploaded file +// $formatted: set to true to display formatted message instead of bare link +function store_file(string $name, string $tmpfile, bool $formatted = false) : void +{ + //create folder, if it doesn't exist + if (!file_exists(CONFIG::STORE_PATH)) + { + mkdir(CONFIG::STORE_PATH, 0750, true); //TODO: error handling + } + + //check file size + $size = filesize($tmpfile); + if ($size > CONFIG::MAX_FILESIZE * 1024 * 1024) + { + header('HTTP/1.0 413 Payload Too Large'); + print("Error 413: Max File Size ({CONFIG::MAX_FILESIZE} MiB) Exceeded\n"); + return; + } + if ($size == 0) + { + header('HTTP/1.0 400 Bad Request'); + print('Error 400: Uploaded file is empty\n'); + return; + } + + $ext = ext_by_path($name); + if (empty($ext) && CONFIG::AUTO_FILE_EXT) + { + $ext = ext_by_finfo($tmpfile); + } + $ext = substr($ext, 0, CONFIG::MAX_EXT_LEN); + + if (CONFIG::LIMIT_EXT) { + $permitted_ext = CONFIG::PERMITTED_EXT; + if ($permitted_ext[$ext] != true) { + header('HTTP/1.0 400 Bad Request'); + return; + } + } + + $tries_per_len=3; //try random names a few times before upping the length + + $id_length=CONFIG::MIN_ID_LENGTH; + if(isset($_POST['id_length']) && ctype_digit($_POST['id_length'])) { + $id_length = max(CONFIG::MIN_ID_LENGTH, min(CONFIG::MAX_ID_LENGTH, $_POST['id_length'])); + } + + for ($len = $id_length; ; ++$len) + { + for ($n=0; $n<=$tries_per_len; ++$n) + { + $id = rnd_str($len); + $basename = $id . (empty($ext) ? '' : '.' . $ext); + $target_file = CONFIG::STORE_PATH . $basename; + + if (!file_exists($target_file)) + break 2; + } + } + + $res = move_uploaded_file($tmpfile, $target_file); + if (!$res) + { + //TODO: proper error handling? + header('HTTP/1.0 520 Unknown Error'); + return; + } + + if (CONFIG::EXTERNAL_HOOK !== null) + { + putenv('REMOTE_ADDR='.$_SERVER['REMOTE_ADDR']); + putenv('ORIGINAL_NAME='.$name); + putenv('STORED_FILE='.$target_file); + $ret = -1; + $out = null; + $last_line = exec(CONFIG::EXTERNAL_HOOK, $out, $ret); + if ($last_line !== false && $ret !== 0) + { + unlink($target_file); + header('HTTP/1.0 400 Bad Request'); + print("Error: $last_line\n"); + return; + } + } + + //print the download link of the file + $url = sprintf(CONFIG::SITE_URL().'/'.CONFIG::DOWNLOAD_PATH, $basename); + + if ($formatted) + { + print("

Uploaded!

Access your file here: $url

"); + } + else + { + print("$url\n"); + } + + // log uploader's IP, original filename, etc. + if (CONFIG::LOG_PATH) + { + file_put_contents( + CONFIG::LOG_PATH, + implode("\t", array( + date('c'), + $_SERVER['REMOTE_ADDR'], + filesize($tmpfile), + escapeshellarg($name), + $basename + )) . "\n", + FILE_APPEND + ); + } +} + +// purge all files older than their retention period allows. +function purge_files() : void +{ + $num_del = 0; //number of deleted files + $total_size = 0; //total size of deleted files + + //for each stored file + foreach (scandir(CONFIG::STORE_PATH) as $file) + { + //skip virtual . and .. files + if ($file === '.' || + $file === '..') + { + continue; + } + + $file = CONFIG::STORE_PATH . $file; + + $file_size = filesize($file) / (1024*1024); //size in MiB + $file_age = (time()-filemtime($file)) / (60*60*24); //age in days + + //keep all files below the min age + if ($file_age < CONFIG::MIN_FILEAGE) + { + continue; + } + + //calculate the maximum age in days for this file + $file_max_age = CONFIG::MIN_FILEAGE + + (CONFIG::MAX_FILEAGE - CONFIG::MIN_FILEAGE) * + pow(1 - ($file_size / CONFIG::MAX_FILESIZE), CONFIG::DECAY_EXP); + + //delete if older + if ($file_age > $file_max_age) + { + unlink($file); + + print("deleted $file, $file_size MiB, $file_age days old\n"); + $num_del += 1; + $total_size += $file_size; + } + } + print("Deleted $num_del files totalling $total_size MiB\n"); +} + +function send_text_file(string $filename, string $content) : void +{ + header('Content-type: application/octet-stream'); + header("Content-Disposition: attachment; filename=\"$filename\""); + header('Content-Length: '.strlen($content)); + print($content); +} + +// send a ShareX custom uploader config as .json +function send_sharex_config() : void +{ + $name = $_SERVER['SERVER_NAME']; + $site_url = str_replace("?sharex", "", CONFIG::SCRIPT_URL()); + send_text_file($name.'.sxcu', << + + +UpChud + + + + + + +
+ +

- - - - - - - - - - - - - UpChud - - - - - - - - - - - -

+

You can upload files to this site via a simple HTTP POST, e.g. using curl:

+
curl -F "file=@./file" $site_url
+

Or simply choose a file and click "Upload" below:

+
+
+Notice: by using this method, you accept that you have lost "The Game" +
+ + + +
+
+
+
+

Limits!

+ +
  • The maximum allowed file size is $max_size MiB.
  • +
  • Files are kept for a minimum of $min_age, and a maximum of $max_age Days.
  • +
  • Permitted filetypes are: +
    +
    $permitted_ext
    +
    +
  • +
    +

    +How long a file is kept depends on its size. Larger files are deleted earlier +than small ones.
    This relation is non-linear and skewed in favour of small +files.
    +

    +
    +
    MIN_AGE + (MAX_AGE - MIN_AGE) * (1-(FILE_SIZE/MAX_SIZE))^$decay
    +
    +
    +

    Aliases

    +These really aren't aliases, but bash functions, but... it's bash. - And I put these in my aliases file. +
    +
    $alias_file
    +
    +
    +

    Source

    +

    The UpChud page's source can be seen on the git.

    +

    The unmodified PHP script used to provide this service is open source and available on +GitHub.

    +
    +

    "Muh TOS"

    +

    - No Porn Or Illegal Activity As Per U.S. Law.

    +

    - For programming, screenshots, small file transfer, & mildly amusing images.

    +
    +

    Contact

    +

    If you want to report abuse of this service, or have any other inquiries, +please write an email to $mail

    +
    + + +EOT; +} + + +// decide what to do, based on POST parameters etc. +if (isset($_FILES['file']['name']) && + isset($_FILES['file']['tmp_name']) && + is_uploaded_file($_FILES['file']['tmp_name'])) +{ + //file was uploaded, store it + $formatted = isset($_REQUEST['formatted']); + store_file($_FILES['file']['name'], + $_FILES['file']['tmp_name'], + $formatted); +} +else if (isset($_GET['sharex'])) +{ + send_sharex_config(); +} +else if (isset($_GET['hupl'])) +{ + send_hupl_config(); +} +else if ($argv[1] ?? null === 'purge') +{ + purge_files(); +} +else +{ + check_config(); + print_index(); +} diff --git a/up/load/.gitkeep b/up/load/.gitkeep new file mode 100644 index 0000000..e69de29