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&"'
相关文档:
只需要在fckeditor\editor\filemanager\connectors\asp文件夹下的commands.asp修改一下即可
在这个文件中查找一下:FileUpload
会找到这个函数
把
代码如下:
Dim sFilePath
sFilePath = CombineLocalPaths(sServerDir, sFileName)
改为
代码如下:
Dim sFilePath,ranNum
Randomize
ranNum=int(90000*rnd)+ ......
第一节:注册系统
注册几乎是每个网站都要使用的,去论坛要注册,聊天要注册,几乎无处不注册,所以注册是所有ASP应用程序中最常见的。
& ......
用ASP设计网站在线人数统计程序
在浏览网页的时侯,常常可以看见一些“当前网站上的人数是XXX人”的在线人数同计。如何用ASP来做一个呢?首先,分析一下它的做法,一般来说,这些线上人数统计都是指一个时段内的访客人数统计。比如(5分钟内,10分钟内)而这个时间的长短,是由设计者设定 ......
用ASP实现支持附件的EMail系统(1)
大家经常探讨使用asp,而不使用其他组建能否实现文件的上传,从而开发出支持邮件附件的邮件系统,答案是可以的。
以下是发送邮件的页面,邮件的帐号是员工号,假设是5位的数字,sendmail.asp当然是在合法登陆后才能够看到的
<html>
<head>
<meta http-eq ......