diff --git a/src/common.php b/src/common.php index 0bf8a7a..ac9ea9f 100644 --- a/src/common.php +++ b/src/common.php @@ -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); } + ?> diff --git a/src/read.php b/src/read.php index b7ea4c3..030f548 100644 --- a/src/read.php +++ b/src/read.php @@ -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); ?>