aboutsummaryrefslogtreecommitdiff
path: root/views
diff options
context:
space:
mode:
Diffstat (limited to 'views')
-rw-r--r--views/archive/index.php2
-rw-r--r--views/archive/topbar.php10
-rw-r--r--views/archive/visit.php7
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();