commit 220bf08514b0703e1162be39639cf5561fce5b67
parent 1211e216ff6ca9777449633427391269e11ca3bc
Author: Florian <flokX@users.noreply.github.com>
Date: Fri, 25 Jan 2019 18:27:07 +0100
Update redirect.php
Adjust paths
Edit counting function
Fix typo
Diffstat:
1 file changed, 6 insertions(+), 7 deletions(-)
diff --git a/redirect.php b/redirect.php
@@ -10,7 +10,7 @@ if ($short === "robots.txt") {
echo "User-agent: *\n";
echo "Disallow: /\n";
exit;
-} else if ($short === 'favicon.ico') {
+} else if ($short === "favicon.ico") {
header("HTTP/1.1 404 Not Found");
exit;
}
@@ -19,12 +19,12 @@ if ($short === "robots.txt") {
function count_access($base_path, $name) {
$filename = $base_path . DIRECTORY_SEPARATOR . "stats.json";
$stats = json_decode(file_get_contents($filename), true);
- $stats[$name][date("Y-m-d")] += 1;
- file_put_contents($filename, json_encode($stats));
+ $stats[$name][mktime(0, 0, 0)] += 1;
+ file_put_contents($filename, json_encode($stats, JSON_PRETTY_PRINT));
}
-$base_path = implode(DIRECTORY_SEPARATOR, array(__DIR__, "secure"));
-$data = json_decode(file_get_contents($base_path . DIRECTORY_SEPARATOR . "configjson"), true);
+$base_path = implode(DIRECTORY_SEPARATOR, array(__DIR__, "admin"));
+$data = json_decode(file_get_contents($base_path . DIRECTORY_SEPARATOR . "config.json"), true);
if (array_key_exists($short, $data["shortlinks"])) {
header("Location: " . $data["shortlinks"][$short], $http_response_code=303);
@@ -87,4 +87,4 @@ if (array_key_exists($short, $data["shortlinks"])) {
</body>
-</html>
-\ No newline at end of file
+</html>