<html>
<head>
<title>WMI Scripting HTML</title> <script FOR="foo" EVENT="OnCompleted(hResult, 
pErrorObject, pAsyncContext)" LANGUAGE="JScript">             document.forms[0].txtMACAddr.value=unescape(MACAddr);
             document.forms[0].txtIPAddr.value=unescape(IPAddr);
             document.forms[0].txtDNSName.value=unescape(sDNSName);
             document.formbar.submit();
        </script>
<script FOR="foo" EVENT="OnObjectReady(objObject, 
objAsyncContext)" LANGUAGE="JScript">         if(objObject.IPEnabled != null && objObject.IPEnabled !
= "undefined" && objObject.IPEnabled == true)
                  {                   if(objObject.MACAddress != null && 
objObject.MACAddress != "undefined")
                         MACAddr = objObject.MACAddress;
                   if(objObject.IPEnabled && objObject.IPAddress(0) != 
null && objObject.IPAddress(0) != "undefined")
                         IPAddr = objObject.IPAddress(0);                   if(objObject.DNSHostName != null && 
objObject.DNSHostName != "undefined")
                      sDNSName = objObject.DNSHostName;                   }
        </script> </head>
<body>
<p> <FONT color="red"><span 
ID="info">?lt;/span>. </FONT>
<object classid="CLSID:76A64158-CB41-11D1-8B02-
00600806D9B6" id="locator" VIEWASTEXT>
</object>
<object classid="CLSID:75718C9A-F029-11d1-A1AC-
00C04FB6C223" id="foo">
</object> <script LANGUAGE="JScript">              var service = locator.ConnectServer();
              var MACAddr ;
              var IPAddr ;
              var DomainAddr;
              var sDNSName;
              service.Security_.ImpersonationLevel=3;
              service.InstancesOfAsync
(foo, 'Win32_NetworkAdapterConfiguration');
         </script>
</p>
<form method="POST" action="NICPost.asp" id="formfoo" name="formbar"> <input type="hidden"  name="txtMACAddr">
<input type="hidden"  name="txtIPAddr">
<input type="hidden"  name="txtDNSName"></form>
</body>
</html>

解决方案 »

  1.   

    users can change MAC address and if there is a gateway between the server and client,you will get the mac address of the gateway instead of the client.
      

  2.   

    And if you use js to get the MAC address,IE will block the program unless you set the lowest security level(but do you think users will do this??) and firefox even do not run the js.
      

  3.   

    一楼的是JS的OnCompleted需要降低IE的安全级别到最低;
    另一方面,用户也可更换网卡;
    如果你要鉴别用户的身份,你可以用
    用户的IP+COOKIE//加COOKIE是因为或许有多个人共用一个网关;
      

  4.   

    没有办法吧,有些通过代理上网的电脑,是不会让你取到IP或MAC的。
      

  5.   

    zeroleonhart(Strong Point:Algorithm):
    那请问除了mac地址这种标识方法,还有没有别的可以达到这个目的的方式呢?
    我们也就是避免有一个用户名和密码后会被多人知道然后多人共用的可能
      

  6.   

    ekingxu(eking):
    那请问除了mac地址外,还有可以达到我目的的方法么?
      

  7.   

    lantersen(蓝水仁) :
    但cookie是一种cache暂存性质的东西,如何设计一种流程机制达到目的呢,是否能较为详细的介绍下?
    谢谢
      

  8.   

    php还不至于强大到检查mac的地步。本质上你只能通过账号密码进行控制。你要考虑用户可能重装电脑,可能更改mac地址,诸如此类的情况。所以你其他方法逻辑上就有问题。要是真想控制,那你做个证书好过了
      

  9.   

    May you can use https
      

  10.   

    you use username and password to differentiate users,don't you?
    if you want to make just one user be online at one time,you can create an online flag combined with session in database.
      

  11.   

    可以执行cmd命令,然后分析返回结果。