error codes sur page read

This commit is contained in:
max/sooulix 2025-02-11 10:15:43 +01:00
parent acd0796f5f
commit ebda5ef7cb
2 changed files with 16 additions and 1 deletions

View File

@ -84,7 +84,6 @@ function share_list($dir)
{
$tsv = tsv_path($child);
var_dump(is_file($tsv));
if (is_file($tsv))
{
return array_merge($carry, read_tsv($child, $tsv));
@ -206,9 +205,16 @@ function find_share($dir, $creation)
return NULL;
}
function error_code($int)
{
header("Location: /", TRUE, $int);
exit();
}
function _($var)
{
print($var);
}
?>

View File

@ -9,8 +9,17 @@ if (isset($_GET['id']))
{
if (gen_identifier($share) == $_GET['id'])
{
$expires_date = DateTime::createFromFormat(
DateTimeInterface::ISO8601,
$share['expires']
);
if ($expires_date < (new DateTime()))
{
error_code(410);
}
zip_response($share['dir']);
}
}
}
error_code(403);
?>