devshort

private self-hosted shortlink service
git clone https://git.clttr.info/devshort.git
Log (Feed) | Files | Refs (Tags) | README | LICENSE

commit 45bf14027e5826db4fcf0a2d5b08d55169925450
parent 230925d62bc00fb9e049d74b6ede45c1da92c125
Author: Florian Kaldowski <flokX@users.noreply.github.com>
Date:   Wed, 10 Apr 2019 13:41:43 +0200

Add access counting
Diffstat:
Mindex.php | 6++++++
1 file changed, 6 insertions(+), 0 deletions(-)

diff --git a/index.php b/index.php @@ -5,6 +5,12 @@ $base_path = implode(DIRECTORY_SEPARATOR, array(__DIR__, "admin")); $config_content = json_decode(file_get_contents($base_path . DIRECTORY_SEPARATOR . "config.json"), true); +// Counts the access +$filename = $base_path . DIRECTORY_SEPARATOR . "stats.json"; +$stats = json_decode(file_get_contents($filename), true); +$stats["Index"][mktime(0, 0, 0)] += 1; +file_put_contents($filename, json_encode($stats, JSON_PRETTY_PRINT)); + // Generator for page customization $links_string = ""; if ($config_content["settings"]["custom_links"]) {