diff options
| author | Syndamia <kamen@syndamia.com> | 2025-02-08 10:14:36 +0000 |
|---|---|---|
| committer | Syndamia <kamen@syndamia.com> | 2025-02-08 10:14:36 +0000 |
| commit | 49f25c00fed83be18faa87295fbc58d69cc2c5d8 (patch) | |
| tree | 407e9b1991c895e82f4ace2effdfafe71a3e7406 /views | |
| parent | 83304592d155b0fed33dcdac3ffdf0b6ca393ab6 (diff) | |
| download | nowayforward_human-49f25c00fed83be18faa87295fbc58d69cc2c5d8.tar nowayforward_human-49f25c00fed83be18faa87295fbc58d69cc2c5d8.tar.gz nowayforward_human-49f25c00fed83be18faa87295fbc58d69cc2c5d8.zip | |
fix(views/archive): Only increment visited counter on opened archive
Diffstat (limited to 'views')
| -rw-r--r-- | views/archive/index.php | 2 | ||||
| -rw-r--r-- | views/archive/topbar.php | 10 | ||||
| -rw-r--r-- | views/archive/visit.php | 7 |
3 files changed, 17 insertions, 2 deletions
diff --git a/views/archive/index.php b/views/archive/index.php index 36c438a..22b8a21 100644 --- a/views/archive/index.php +++ b/views/archive/index.php @@ -8,8 +8,6 @@ normalizeUrl($url); $page = Database\Webpage::fromDB($url); - $page->incrementVisits(); - $user = Database\Cookie::fromDB($TOKEN); } catch(Exception $e) { diff --git a/views/archive/topbar.php b/views/archive/topbar.php index b00a33d..9bf52f7 100644 --- a/views/archive/topbar.php +++ b/views/archive/topbar.php @@ -29,3 +29,13 @@ <? endif; ?> </div> </div> + +<script type="text/javascript"> +// If not in iframe +if (window.self === window.top) { + var request = new XMLHttpRequest(); + request.open("POST", "/archive/visit.php", true); + request.setRequestHeader('Content-type', 'application/x-www-form-urlencoded'); + request.send('wid=' + <?= $currentPage->WID ?>); +} +</script> diff --git a/views/archive/visit.php b/views/archive/visit.php new file mode 100644 index 0000000..aa681e1 --- /dev/null +++ b/views/archive/visit.php @@ -0,0 +1,7 @@ +<?php + +require_once "../../models/database.php"; +require_once "../../models/webpage.php"; + +$page = Database\Webpage::fromDBwid($_POST['wid']); +$page->incrementVisits(); |
