上一篇:一个可以读取ID3信息的类[可以很方便添加MP3了] >>
asp记录日志程序
?‘’username :用户信息(标示进行该操作的人员)
‘’operate :操作(标示用户进行了什么操作)
‘’userip :用户IP(标示用户用于登录系统的计算机的IP地址)
‘’opdate :用户操作发生的日期
‘’日志写入一个xml文件,第一次写入时如果xml文件不存在,则创建。 ‘’返回值:0 表示输入的参数无效 ‘’返回值:1 表示打开日志文件时出错 ‘’返回值:9 表示正确完成写入日志文件
?function WriteLog(username,operate,userip,opdate)
if username="" or operate="" or userip="" or opdate="" then
WriteLog=0 ‘’参数无效
exit function
end if
RootNode="syslog"
‘’日志文件根节点名字
LogFile=server.mappath("uuu.xml") ‘’日志文件路径
set fso=server.CreateObject("scripting.filesystemobject")
‘’如果日志文件不存在,就创建一个,并写入头信息和根信息
if not fso.FileExists(LogFile) then
fso.CreateTextFile LogFile
set fff=fso.GetFile(LogFile)
set mmm=fff.openastextstream(2)?
mmm.write "《?xml version=""1.0"" encoding=""gb2312"" ?〉" & vbcrlf & "《" & rootnode & "〉《/" & rootnode & "〉"
set mmm=nothing
set fff=nothing
else
Response.Write("文件名冲突!")
Response.End
end if
set fso=nothing
Set xd = Server.CreateObject("msxml2.domdocument")
xd.async = false xd.load(LogFile)
if xd.parseError.errorcode<>0 then
WriteLog=1 ‘’打开日志文件出错
exit function
end if
‘’创建新节点信息
set et=xd.documentElement
set cnode=xd.createElement("log")
et.appendchild(cnode)
set node2=xd.createElement("username")
node2.text=username
cnode.appendchild(node2)
set node2=xd.createElement("operate")
node2.text=operate
cnode.appendchild(node2)
set node2=xd.createElement("userip")
node2.text=userip
cnode.appendchild(node2)
set node2=xd.createElement("opdate")
node2.text=opdate
cnode.appendchild(node2)
xd.save LogFile ‘’写入日志文件
set cnode=nothing
set node2=nothing
set xd=nothing
writeLog=9 ‘’说明正常写入了日志信息
end function
下一篇:在Web上用style实现完美颜色渐变 >>
相关文章:
- · ASP中的Debug类(VBScript)
- · html编辑器中,有很多无法得到系统的字体,这个脚本可以
- · Microsoft的25位CDKey里有什么
- · 一个很强的验证脚本
- · 深入剖析C#继承机制(2)
- · 深入剖析C#继承机制(1)
- · 在c# Form中创建一个可拖动的矩形流程节点
- · 纯ASP(VBscript)写的全球IP地址搜
- · 实现有管理功能的ASP留言板
- · 一个ASP版的图片浏览管理器
- · Recordset对象方法
- · 利用Helix Server的SMIL支持在ASP中生成媒体流的播放列表
- · 运用Stored Procedure实现商城的月销售量报表
- · 运用Stored Procedure验证login的输入
- · ASP在线压(缩)解(压)rar
- · 如何实现无刷新的DropdownList联动效果
- · 查找Table中的单个列长度并判断是否属于改表(存储过程)
- · 将ASP纪录集输出成n列的的表格形式显示的方法
- · C#排序算法大全
- · 九月份精彩网络讲座让您深入了解微软最新开发技术
- · DHTML技巧--中止网页的提交
- · 分页控制
- · 用ASP实现中英文字体的自动选择
- · 使用ADSI创建虚拟目录
- · asp+的论坛列表程序---代码部分
- · 从ASP迁移至ASP+ --转换其他的页面吧
- · 从ASP迁移至ASP+ -----进入DataSet
- · 一个非常简单的将半角转换为中文的函数
- · 从ASP迁移至ASP+
- · 从ASP迁移至ASP+ --将HTML表格转换为ASP+数据列表
- · 从ASP迁移至ASP+ --处理会话变量(Session Variables)
- · asp+的论坛列表程序---页面部分
- · 关闭屏幕保护
- · 在ASP中使用“Request”时应注意的问题
- · 用ASP+制作图形
- · 在ASP中使用断开的记录集
- · ASP.NET与ASP的不同
- · 小窗口大学问--玩转弹出窗口
