据我所知,我无法使用 javascript 或 php 获取 mac 地址 - 除了一些 IE 用户并且只有当他们有 activeX 时。
但是这里有两个相似的场景: 而且我认为这些不是重复的问题...
1) 如果网站托管在本地并且人们通过 wifi 访问表单,我可以获取每个用户(windows、android、apple 等)的 mac 地址吗? 如果是,这可以用 php/javascript 完成吗?
2) 如果我只想跟踪来自一个网络的用户,但该站点托管在其他地方的某个 Linux 服务器上,我能否获得每个用户(Windows、Android、Apple 等)的 MAC 地址?如果是,这可以用 php/javascript 完成吗?
• 如果您需要知道我为什么要这样做:这是为了在夜总会进行在线抽奖,我们想要跟踪 mac 地址,因此您只能在每台设备上注册一次。
最佳答案
Can I get the mac-address of EVERY user (windows, android, apple, etc.) if I only want to track users from ONE network, but the site is hosted on some linux server somewhere else? And if yes, can this be done with php/javascript?
这通常是不可能的。
Can I get the mac-address of EVERY user (windows, android, apple, etc.) if the website is hosted locally and people access a form via wifi? And if yes, can this be done with php/javascript?
如果 Web 客户端与服务器位于同一子网上,您可以从 ARP 表中读取映射。在 Linux 上,使用您的 PHP 脚本打开文本文件 /proc/net/arp
,并使用提供的 $_SERVER['REMOTE_ADDR']
查找 MAC 地址。
In case you need to know why I want to do this: This is for an online draw at a night club and we would like track mac-addresses, so you can only sign up once with every device.
在本地网络上,通过过滤 MAC 地址而不是 IP 地址来获得安全性。主机的 MAC 地址在大多数平台上都可以轻松更改。
关于javascript - 本地网络中的 mac 地址(JavaScript 或 PHP),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31548188/