You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
52 lines
1.1 KiB
52 lines
1.1 KiB
<html>
|
|
<meta http-equiv="refresh" content="60" />
|
|
<head>
|
|
<title>訪客計數器 原型</title>
|
|
</head>
|
|
<body>
|
|
<a>訪客計數器 原型</a>
|
|
<p id="msg"></p>
|
|
|
|
<script>
|
|
var m = document.getElementById("msg");
|
|
|
|
if (navigator.geolocation) {//
|
|
navigator.geolocation.getCurrentPosition(showPosition);//有拿到位置就呼叫 showPosition 函式
|
|
} else {
|
|
m.innerHTML = "您的瀏覽器不支援 顯示地理位置 API ,請使用其它瀏覽器開啟 這個網址";
|
|
};
|
|
|
|
function showPosition(position) {
|
|
m.innerHTML = " 緯度 (Latitude): " + position.coords.latitude +
|
|
"<br>經度 (Longitude): " + position.coords.longitude;
|
|
};
|
|
</script>
|
|
|
|
<?php
|
|
/*
|
|
simple access counter for php3
|
|
(c)1998 David W. Bettis
|
|
dbettis@eyeintegrated.com
|
|
medify by Wilson Peng
|
|
*/
|
|
|
|
$counterFile = "counter.txt";
|
|
|
|
function displayCounter($counterFile) {
|
|
$fp = fopen($counterFile,"rw");
|
|
$num = fgets($fp,5);
|
|
$num = strval(intval($num) + 1);
|
|
print "您是第 "."$num"." 位無聊份子";
|
|
exec( "rm -rf $counterFile");
|
|
exec( "echo $num > $counterFile");
|
|
}
|
|
|
|
if (!file_exists($counterFile)) {
|
|
exec( "echo 0 > $counterFile");
|
|
}
|
|
|
|
displayCounter($counterFile);
|
|
|
|
?>
|
|
</body>
|
|
</html>
|