学习过程中遇到的几个问题~盼指教
以下的问题都是在看书过程中遇到的,实在想出解决的办法,请各位给分析分析,50分送上
第一个问题:adrotator组件问题
<%
dim ad
set ad=server.CreateObject("mswc.adrotator")
ad.clickable=(true) 问题:
response.Write ad.getadvertisement("show.txt") '错误提示是无法加载轮换计划文件,请问这个出错的原因?'
set ad=nothing
%>
第二个问题:scripting.filesystemobject组件问题
<%
function counts(counterfile)
dim objfso,objts
application.Lock
set objfso=server.CreateObject("scripting.filesystemobject")
set objts=objfso.OpenTextFile(server.mappath("counterfile.txt"),1,true)
if not objts.atendofstream then
counts=clng(objts.readline)
end if
counts=counts+1
objts.close 问题:
set objts=objfso.OpenTextFile(server.mappath("counterfile.txt"),2,true) '错误提示权限不够?原因是?'
objts.writeline(counts)
objts.close
application.UnLock
end function
%>
<title>application</title>
</head>
<body>
你是第<%=counts("counter.txt")%>
</body>
</html>
第三个问题:邮件发送的问题
<%
tomail=request.Form("dizhi") 问题:
set mail=server.CreateObject("CDONTS.NewMail") '错误提示无效的类别字符串,书上也是这么写的实在不知道哪错了?'
mail.from=tomail
mail.subject="内容"
mail.to="主题"
mail.bodyformat=0
mail.mailformat=0
mail.send
response.Write("已经成功发出")
%>
最后个问题:做的一个关于统计在线人数的,请各位帮忙看看这样的想法行不?可以的话请大虾帮忙改改
<%
dim tmp(),num,refreshtime,idtime
refreshtime=10
idtime=refreshtime*3
if application(session.SessionID&"lasttime")=empty then
if application("all")=empty then
application("all")=0
num=0
end if 问题:
tmp(num)=session.SessionID '错误提示 下标越界,不知道为啥??'
num=num+1
application("all")=application("all")+1
end if
application(session.SessionID&"lasttime")=timer
for i=0 to ubound(tmp)
if timer-application(tmp(i)&"lasttime")>idtime then
application(tmp(i)&"lasttime")=empty
tmp(i)=empty
application("all")=application("all")-1
end if
next
%>
<html>
<head>
<meta http-equiv="refresh" content="<%=refreshtime%>",url=<%=request.ServerVariables("path_info")%>>
</head>
<body>
在线人数是<%=application("all")%>人
</body>
</html>
不知道这样的方法能不能成功进行人数的统计?
请大虾们不吝指教~~~~~~~~~