But this is only to get the sender's IP address and MAC address, but also prohibit users to change their own IP address code, because our system is the need for personal modification of the IP behavior to prohibit.
<%
StrIP = Request.ServerVariables ("REMOTE_ADDR")
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 and 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
Strmac = getmacaddress
Set Conn=server. CreateObject ("Adodb.connection")
Conn.Open "dsn=; uid=; Pwd= "
Dsnpath= "dsn=; uid=; Pwd= "
Set Rs=server. CreateObject ("Adodb.recordset")
Sele= "SELECT * from Getmac where g_mac= '" &strMac& ""
Rs.Open Sele,dsnpath
If Rs.bof Then
Set Conn=server. CreateObject ("Adodb.connection")
Conn.Open "dsn=; uid=; Pwd= "
Dsnpath= "dsn=; uid=; Pwd= "
Set Rs=server. CreateObject ("Adodb.recordset")
G_id=mid (strip,9)
G_id=left (g_id,2)
' Response.Write g_id
If IsNumeric (g_id) Then
G_id=cint (g_id)
Else
G_id=0
End If
sele= INSERT INTO Getmac (G_IP,G_MAC,G_ID,G_OK) VALUES (' &strIP& ', ' &strMac& ', ' &g_id& ', 0 )"
Rs.Open Sele,dsnpath
Else
Set Conn=server. CreateObject ("Adodb.connection")
Conn.Open "dsn=; uid=; Pwd= "
Dsnpath= "dsn=; uid=; Pwd= "
Set Rs=server. CreateObject ("Adodb.recordset")
Sele= "SELECT * from Getmac where g_ip= '" &trim (StrIP) & "' and G_mac= '" &trim (STRMAC) & ""
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.