不错呦!smile@林凯西,确保“准备文件”中的几个文件都有安装,S...您好,看了您这篇帖子觉得很有帮助。但是有个问题想请...我的修改过了怎么还被恶意注册呢 @jjjjiiii 用PJ快9年了,主要是A...PJ3啊,貌似很少有人用PJ了,现在不是WP就是z...@332347365,我当时接入时错误码没有-10...楼主,ChkValue值应为-103是什么意思呢?...大哥 你最近能看到我发的信息,请跟我联系,我有个制...
动网:增加用户访问列表
编辑:dnawo 日期:2007-06-15
上图为最终的效果,可以很方便的查看每天用户登录的具体时间。
本次修改针对7.1 sp1版,打开login.asp中增加两个函数FormatDate和WriteLogin:
复制内容到剪贴板 程序代码
'==========用户访问登记=========
Function FormatDate()
Dim iYear,iMonth,iDay
iYear = year(now())
iMonth = month(now())
iDay = day(now())
iMonth = Right("0" & iMonth,2)
iDay = Right("0" & iDay,2)
FormatDate = iYear & "-" & iMonth & "-" & iDay
End Function
Function WriteLogin(user)
Dim xmlPath
Dim objDom,objRoot,objAtt,objTemp,objTemp2,objTemp3,objTemp4
xmlPath = Server.MapPath("inc/info.xml")
'判断文件是否存在
Set objDom = Server.CreateObject("Microsoft.XMLDom")
objDom.async = false
If not objDom.load(xmlPath) Then
Set objRoot = objDom.CreateElement("xml")
objDom.appendChild objRoot
objRoot.SelectSingleNode("//xml").appendChild objDom.CreateElement("login")
objRoot.SelectSingleNode("//xml/login").SetAttributeNode objDom.CreateNode("attribute","date","")
objRoot.SelectSingleNode("//xml/login/@date").text = FormatDate
Else
Set objRoot = objDom.documentElement
End if
'判断是否有当天的登录节点,没有就添加
Set objTemp = objRoot.SelectSingleNode("//xml").childNodes.item(objDom.SelectSingleNode("//xml").childNodes.length-1).GetAttributeNode("date")
If objTemp.nodevalue <> FormatDate Then
Set objTemp2 = objDom.CreateElement("login")
Set objAtt = objDom.CreateNode("attribute","date","")
objAtt.Text = FormatDate
objTemp2.SetAttributeNode objAtt
objRoot.appendChild objTemp2
End If
'添加用户登录信息
Set objTemp3 = objRoot.SelectSingleNode("//xml/login[@date='" & FormatDate & "']")
Set objTemp4 = objDom.CreateElement("user")
objTemp4.text = user
objTemp4.SetAttributeNode objDom.CreateNode("attribute","time","")
objTemp4.GetAttributeNode("time").NodeValue = hour(now()) & ":" & minute(now()) & ":" & second(now())
objTemp3.appendChild objTemp4
objDom.save xmlPath
End Function
'==========登记结束 访问:inc/info.xml==========
Function FormatDate()
Dim iYear,iMonth,iDay
iYear = year(now())
iMonth = month(now())
iDay = day(now())
iMonth = Right("0" & iMonth,2)
iDay = Right("0" & iDay,2)
FormatDate = iYear & "-" & iMonth & "-" & iDay
End Function
Function WriteLogin(user)
Dim xmlPath
Dim objDom,objRoot,objAtt,objTemp,objTemp2,objTemp3,objTemp4
xmlPath = Server.MapPath("inc/info.xml")
'判断文件是否存在
Set objDom = Server.CreateObject("Microsoft.XMLDom")
objDom.async = false
If not objDom.load(xmlPath) Then
Set objRoot = objDom.CreateElement("xml")
objDom.appendChild objRoot
objRoot.SelectSingleNode("//xml").appendChild objDom.CreateElement("login")
objRoot.SelectSingleNode("//xml/login").SetAttributeNode objDom.CreateNode("attribute","date","")
objRoot.SelectSingleNode("//xml/login/@date").text = FormatDate
Else
Set objRoot = objDom.documentElement
End if
'判断是否有当天的登录节点,没有就添加
Set objTemp = objRoot.SelectSingleNode("//xml").childNodes.item(objDom.SelectSingleNode("//xml").childNodes.length-1).GetAttributeNode("date")
If objTemp.nodevalue <> FormatDate Then
Set objTemp2 = objDom.CreateElement("login")
Set objAtt = objDom.CreateNode("attribute","date","")
objAtt.Text = FormatDate
objTemp2.SetAttributeNode objAtt
objRoot.appendChild objTemp2
End If
'添加用户登录信息
Set objTemp3 = objRoot.SelectSingleNode("//xml/login[@date='" & FormatDate & "']")
Set objTemp4 = objDom.CreateElement("user")
objTemp4.text = user
objTemp4.SetAttributeNode objDom.CreateNode("attribute","time","")
objTemp4.GetAttributeNode("time").NodeValue = hour(now()) & ":" & minute(now()) & ":" & second(now())
objTemp3.appendChild objTemp4
objDom.save xmlPath
End Function
'==========登记结束 访问:inc/info.xml==========
在ChkUserLogin函数中查找"If EnabledSession Then Session(Dvbbs.CacheName & "UserID")=Dvbbs.UserSession.xml",在此句后添加:
WriteLogin (Dvbbs.UserSession.documentElement.selectSingleNode("userinfo/@username").text)
保存即可!
访问列表文件查看:inc/info.xml
评论: 1 | 引用: 0 | 查看次数: 4187
发表评论
请登录后再发表评论!