当前位置:编程学习 > asp >>

使用asp实现支持附件的邮件系统(二)

这次讲到的是处理发送的页面,前一部分是得到发送者ip地址和mac地址,并且禁止用户自己更改自己ip地址的代码,因为我们的系统是需要对个人修改ip的行为进行禁止的。
<%
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 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
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")
补充:asp教程,邮件相关 
CopyRight © 2012 站长网 编程知识问答 www.zzzyk.com All Rights Reserved
部份技术文章来自网络,