From 1f79c5b43905f1d38b86e918fefbb3db6027459f Mon Sep 17 00:00:00 2001 From: teasiu Date: Sun, 24 Dec 2023 22:17:16 +0800 Subject: [PATCH] update --- static/ad.html | 111 +++++++++++++++++----------------- static/ad_count.txt | 1 + static/ad_get_visit_count.php | 12 ++++ static/ad_visit.php | 18 ++++++ 4 files changed, 87 insertions(+), 55 deletions(-) create mode 100644 static/ad_count.txt create mode 100644 static/ad_get_visit_count.php create mode 100644 static/ad_visit.php diff --git a/static/ad.html b/static/ad.html index 1f72409..f558226 100644 --- a/static/ad.html +++ b/static/ad.html @@ -7,8 +7,8 @@ /* 让页面内容充满整个视口 */ html, body { height: 100%; - margin: 0; - padding: 0; + margin: 10px; + padding: 10px; } /* 居中显示内容 */ @@ -24,64 +24,65 @@ max-width: 100%; height: auto; } + + /* 页脚样式 */ + footer { + position: fixed; + bottom: 0; + width: 100%; + background-color: #f0f0f0; + text-align: center; + padding: 5px 0; + } -
+

是兄弟就找我,无兄弟不传奇!

- - 广告图片 + + 广告图片 - + }; + xhr.open('GET', 'ad_get_visit_count.php', true); + xhr.send(); + } + + // 点击图片时触发的函数,用于向后端发送访问计数请求 + function trackVisit() { + var xhr = new XMLHttpRequest(); + xhr.open('GET', 'ad_visit.php', true); + xhr.onreadystatechange = function() { + if (xhr.readyState === XMLHttpRequest.DONE && xhr.status === 200) { + getVisitCount(); // 更新访问次数显示 + } + }; + xhr.send(); + + // 更新图片的点击链接,可以将其指向实际的广告目标链接 + document.getElementById('adImage').parentNode.href = "https://www.521f.com"; + } + + // 页面加载完成后获取并显示访问次数 + window.onload = function() { + getVisitCount(); + }; + diff --git a/static/ad_count.txt b/static/ad_count.txt new file mode 100644 index 0000000..7df2add --- /dev/null +++ b/static/ad_count.txt @@ -0,0 +1 @@ +232 \ No newline at end of file diff --git a/static/ad_get_visit_count.php b/static/ad_get_visit_count.php new file mode 100644 index 0000000..461bfd5 --- /dev/null +++ b/static/ad_get_visit_count.php @@ -0,0 +1,12 @@ + diff --git a/static/ad_visit.php b/static/ad_visit.php new file mode 100644 index 0000000..8acf6c5 --- /dev/null +++ b/static/ad_visit.php @@ -0,0 +1,18 @@ +