【问题标题】:Track users with PHP and JavaScript使用 PHP 和 JavaScript 跟踪用户
【发布时间】:2011-12-28 06:50:13
【问题描述】:

我是否遗漏了任何可以记录以跟踪访问者的明显信息(使用 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>

【问题讨论】:

  • 注意;请记住,几乎一切都是可欺骗的。
  • 在从 IP 地址查找站点抓取数据后,您可以从 IP 地址获取国家和可能的城市。
  • 感谢博兹多斯的提示!是否有任何免费的 IP 地址查找(不错的公司不会对我正在检查的 IP 地址做坏事......)?
  • Bracketworks,你所说的可恶作剧是什么意思?该访客可以伪装成其他人吗?
  • 任何人都可以伪装成别人。

标签: php javascript ip tracking visitor-pattern


【解决方案1】:

有很多可用的地理位置数据库。如果您想免费使用,也有一些免费数据库,其更新频率低于付费数据库,例如MaxMind GeoLite

更多谷歌请关注IP geolocation

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2015-04-09
    • 2010-10-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多