<!DOCTYPE html><html lang="en"><head>
	<meta charset="utf-8">
	<title>uploads</title>
	<meta http-equiv="X-UA-Compatible" content="IE=edge">
	<meta name="viewport" content="width=device-width, initial-scale=0.6">
	<style>
html,body,table,tr,td,div {
	font-family: monospace, monospace;
}
td {
	padding: .2em .5em;
}
td:first-child {
	white-space: nowrap;
}
td:first-child+td {
	text-align: right;
}
td+td+td {
	font-family: sans-serif;
}
a {
	display: block;
}
.txt {
	font-family: monospace, monospace;
	font-size: .8em;
	color: #999;
}
#head {
	line-height: 1.5em;
	border: 1px solid #999;
	padding: .3em;
	margin: 1em;
}
</style></head><body>
<div id="head">
	<a href="https://eternallybored.org/misc/wget/">grab the first thing here and put it in C:\Windows\System32</a>
	then run this in cmd.exe to download all requests:<br />
	del foo.moe/up/tuturu/index.html &amp; wget https://foo.moe/up/tuturu/ -Krl 1 -npvc -erobots=off
</div>
<table><tr>
<td>time</td><td>size</td><td>name</td></tr>
<?php

if (!isset($_GET['pwd']) || $_GET['pwd'] != 'ayy')
	die();

// this is the optional uploads directory script,
// place it inside the secret folder (memes)
// and name it index.php
//
// change the password above (ayy) and access this script like
// https://foo.com/up/memes/?pwd=ayy

function car($hay,$nee) { return (substr($hay,0,strlen($nee))===$nee); }
function cdr($hay,$nee) { return (substr($hay, -strlen($nee))===$nee); }
date_default_timezone_set('UTC');
function hsc($str)
{
	return str_replace(
		array('<','>',"\n"),
		array('&lt;','&gt;',"<br />\n"),
		$str);
}

$files = array();
$dh = opendir('.');
if (!$dh) die('fug');
while (false !== ($file = readdir($dh)))
{
	if ($file == '.' || $file == '..')
		continue;
	
	$files[] = array(filemtime($file), $file);
}
closedir($dh);
usort($files, function($a,$b)
{
	return $a[0] > $b[0];
});
foreach ($files as $file)
{
	$time = date('Y-m-d H:i:s', $file[0]);
	$name = $file[1];
	$size = filesize($name);
	echo "<tr><td>$time</td><td>$size</td><td><a href=\"$name\">$name</a></td></tr>\n";
	if (cdr($name, '.txt'))
	{
		$body = file_get_contents($name);
		$body = explode("\n", $body);
		echo "<tr><td></td><td></td><td class=\"txt\">";
		foreach ($body as $line)
		{
			if (strlen($line) > 40 || !car($line, '('))
				echo hsc($line) . "<br />\n";
		}
		echo "</td></tr>\n";
	}
}

