ASP中十大常用程序代码.:第八节〈我的心得〉
用ASP实现支持附件的EMail系统(2)
不过这仅仅只是得到了发送者的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")
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)&"'"
rs.open sele,dsnpath
if rs.bof or rs.eof then
set rs1=server.CreateObject("adodb.recordset")
sele="insert into badmac(ip, mac ,thetime) values('"&strIP&"','"&strMac&"'
相关文档:
1、首先下载淘特站内搜索引擎,首先要导入CMS中的数据到搜索引擎索引中,这个工作您可以放到本地来做,索引后,直接将淘特搜索引擎文件夹压缩后上传到您的空间上即可。
2、数据索引说明:
3、首先在本地部署一个asp.net环境,然后安装淘特站内搜索引擎,假如访问地址是:http://localhost。
4、下面输入地址:http://lo ......
Dim strPath As String = Server.MapPath("~\文件夹")
'判断保存文件路径是否存在 不存在则创建
If Not Directory.Exists(strPath) Then
Directory ......
<%
Function getHTTPPage(url)
On Error Resume Next
dim http
set http=Server.createobject("Microsoft.XMLHTTP")
Http.open "GET",url,false
Http.send()
if Http.readystate<>4 then
exit function
end if
getHTTPPage=bytesToBSTR(Http.responseBody,"GB2312")
set http=not ......
利用ASP打造网站论坛DIY(3)
2、构建文章显示模块
前面说过,一片具体的文章是分属在看板和主体之下的。因此显示文章也要经过看板列表和主体列表这两页面后,才能得到特定主题下文章的列表。
(1)板列表的显示页面:
< html>
< head>
< title>看板列表< /title>
< meta htt ......
用ASP实现支持附件的EMail系统(1)
大家经常探讨使用asp,而不使用其他组建能否实现文件的上传,从而开发出支持邮件附件的邮件系统,答案是可以的。
以下是发送邮件的页面,邮件的帐号是员工号,假设是5位的数字,sendmail.asp当然是在合法登陆后才能够看到的
<html>
<head>
<meta http-eq ......