程序師世界是廣大編程愛好者互助、分享、學習的平台,程序師世界有你更精彩!
首頁
編程語言
C語言|JAVA編程
Python編程
網頁編程
ASP編程|PHP編程
JSP編程
數據庫知識
MYSQL數據庫|SqlServer數據庫
Oracle數據庫|DB2數據庫
 程式師世界 >> 數據庫知識 >> Access數據庫 >> 關於Access數據庫 >> 獲得客戶端的MAC(Media Access Control)地址

獲得客戶端的MAC(Media Access Control)地址

編輯:關於Access數據庫
Get the clIEnts Mac(Media Access Control) address, a hardware address that uniquely identifIEs each
node of a network. Works great on LAN's. Firewalls and Proxy's will be an issue depending what side of
them you're coding for.

Can't Copy and Paste this?
Click here for a copy-and-paste frIEndly version of this code! '**************************************
' for :Mac address
'**************************************
This code is AS IS! I had a need For it on a
project I was working On and found almost no info
anywhere On what I needed To accomplish. If it
helps you, great! If it does Not work For you:
1.Make sure you're Not trying To hit on the same
pc it's on.
2.Comment out where the file gets deleted
(fso.deletefile "c:\" & strIP & ".txt"), To vIEw
some potential Error info.
3.Have fun debugging :) (I did)
code:
Can't Copy and Paste this?
Click here for a copy-and-paste frIEndly version of this code! '**************************************
' Name: Mac address
' Description:Get the clIEnts Mac(Media
' Access Control)
address, a hardware address that uniquely
identifIEs Each node of a network. Works great on
LAN's. Firewalls and Proxy's will be an issue
depending what side of them you're coding for.
' By: Jerry Aguilar
'
'
' Inputs:None
'
' Returns:Returns the clIEnt IP and Mac
' address.
'
'Assumes:You can't navigate to it runnin
' g PWS on the same
pc but If you are running PWS, you can navigate
To it from another pc on the same lan (it does
Not like 127.0.0.1)
'
'Side Effects:None
'
'Warranty:
'code provided by Planet Source Code(tm)
' (www.Planet-Source-Code.com) 'as is', wi
' thout warrantIEs as to performance, fitn
' ess, merchantability,and any other warra
' nty (whether expressed or implIEd).
'Terms of Agreement:
'By using this source code, you agree to
' the following terms...
' 1) You may use this source code in per
' sonal projects and may compile it into a
' n .exe/.dll/.ocx and distribute it in bi
' nary format freely and with no charge.
' 2) You MAY NOT redistribute this sourc
' e code (for example to a web site) witho
' ut written permission from the original
' author.Failure to do so is a violation o
' f copyright laws.
' 3) You may link to this code from anot
' her website, provided it is not wrapped
' in a frame.
' 4) The author of this code may have re
' tained certain additional copyright righ
' ts.If so, this is indicated in the autho
' r's description.
'**************************************

<%@ LANGUAGE="VBSCRIPT"%>
<%
strIP = Request.ServerVariables("REMOTE_ADDR")
strMac = GetMacAddress(strIP)
strHost = Request.ServerVariables("REMOTE_HOST")
Function GetMacAddress(strIP)
Set net = Server.CreateObject("wscript.Network")
Set sh = Server.CreateObject("wscript.shell")
sh.run "%comspec% /c nbtstat -A " & strIP & " > c:\" & strIP & ".txt",0,true
Set sh = nothing
Set fso = createobject("scripting.filesystemobject")
Set ts = fso.opentextfile("c:\" & strIP & ".txt")
Macaddress = null
Do While Not ts.AtEndOfStream
data = ucase(trim(ts.readline))
If instr(data,"Mac ADDRESS") Then
Macaddress = trim(split(data,"=")(1))
Exit Do
End If
loop
ts.close
Set ts = nothing
fso.deletefile "c:\" & strIP & ".txt"
Set fso = nothing
GetMACAddress = Macaddress
End Function
%>
<Html>
<HEAD>
<TITLE>Say Hello To the Mac MAN</TITLE>
</HEAD>
<BODY>
<%Response.Write("Your IP is : " & strIP & "<BR>" & vbcrlf)%>
<%Response.Write("Your MAC is : " & strMac & vbcrlf)%>
</BODY>
</Html>   
  1. 上一頁:
  2. 下一頁:
Copyright © 程式師世界 All Rights Reserved