2011-11-13 93 views
1

我錯過了任何明顯的事情,您可以登錄以跟蹤訪問者(使用PHP和JavaScript)?使用PHP和JavaScript跟蹤用戶

  • 我可以得到計算機名嗎?
  • 我可以得到國家嗎?
  • 我可以去這個城市嗎?
  • 郵編?
  • 可以從某些瀏覽器收集的任何其他信息?

PHP文件:

<script> 

<?php 
$ip = $_SERVER['REMOTE_ADDR']; 
$hostaddress = gethostbyaddr($ip);?> 
<?php echo "document.write('The IP-adress: ' + " . "'" . $ip . "'" . " + '<br>');";?> 
<?php echo "document.write('The host address: ' + " . "'" . $hostaddress . "'" . " + '<br>');";?> 

document.write('The date: ' + new Date() + '<br>'); 
document.write('Get the entire URL of the current page: ' + location.href + '<br>'); 
document.write('This document was last modified on:' + document.lastModified + '<br>'); // good to know wich version of the page they have 

if (document.referrer != ''){ 
document.write('The referrer of this document is: ' + document.referrer + '<br>') 
} 
else{ 
document.write('The is no referrer.<br>') 
} 

document.write('Number of URLs in history list: ' + history.length + '<br>') 

// I know it doesn't allways return the right browser info, but it gives a good clue. 
document.write("Browser name: " + navigator.appName + '<br>'); 
document.write("Browser version info: " + navigator.appVersion + '<br>'); 
document.write("Platform: " + navigator.platform + '<br>'); 
document.write("User-agent header sent: " + navigator.userAgent + '<br>'); 
document.write("Language of user: " + navigator.userLanguage); 

document.write("Total Height: " + screen.height + '<br>'); 
document.write("Total Width: " + screen.width + '<br>'); 

document.write("Cookie: " + document.cookie + '<br>'); 

</script> 
+4

注意;請記住幾乎*所有*都是可欺騙的。 – Dan

+0

從ip地址查找站點獲取數據後,您可以從ip地址獲取國家和城市。 – bozdoz

+0

感謝您的提示bozdoz!有沒有免費的IP地址查找(不錯的公司,不會用我正在檢查的IP地址做壞事...)? – Hakan

回答

1

有可用的很多地理位置數據庫。如果你想免費,也有一些免費的數據庫,其更新頻率比付費對象少,例如, MaxMind GeoLite

For more Google for IP geolocation