注册 登录
编程论坛 ASP技术论坛

请版主帮忙:为什么计数器会自己增加点击量(请版主帮忙,已经一周都没有解决了。苦啊)

fireing 发布于 2008-04-30 13:07, 1150 次点击
为什么计数器会自己增加点击量,很郁闷啊。帮忙注释一下这个程序。那里错了怎么修改。
<%
if session("over")="" then
    jsqtoday=1
    if application("dntime")<=cint(hour(time())) then       '在百度搜索的时候说这句话有问题
    conn.execute("update dept set jsqtoday=jsqtoday+1")
    tmprs=conn.execute("Select jsqtoday from dept")
    jsqtoday=tmprs(0)
    else
    conn.execute("update dept set jsqtoday=1")
    tmprs=conn.execute("Select jsqtoday from dept")
    jsqtoday=tmprs(0)
    end if
    application("dntime")=cint(hour(time()))
    set tmprs=nothing
   
    conn.execute("update dept set jsq=jsq+1")
    tmprs=conn.execute("Select jsq from dept")
    jsq=tmprs(0)
    set tmprs=nothing
   
    session("over")=true
else
    jsqtoday=1
    tmprs=conn.execute("Select jsqtoday from dept")
    jsqtoday=tmprs(0)
    
    tmprs=conn.execute("Select jsq from dept")
    jsq=tmprs(0)
    set tmprs=nothing
end if
%>

[[it] 本帖最后由 fireing 于 2008-5-2 16:21 编辑 [/it]]
8 回复
#2
bjbaima2008-04-30 14:38
你这是统计文章的点击量吗?不需要这么复杂吧!
#3
fireing2008-04-30 15:56
这是一个网站首页的统计,请 指点。
#4
bjbaima2008-04-30 16:02
if application("dntime")<=cint(hour(time()))
改成
if application("dntime")<cint(hour(time()))
#5
fireing2008-04-30 16:54
这个什么意思啊 。
#6
fireing2008-04-30 17:08
application("dntime")<=cint(hour(time())) then '这样判断是什么意思?有没有错?

这句有错!
编程者的思想是:
application("dntime")存储了最后一个访客的小时时间值,如果下一个访客的小时时间值比这个小的话,那么就是第二天了,或者以后了,而不是同一天了,则把jsqtoday的值归为1。
但是,如果今天只有上午有人访问,下行没有了,而明天只是到了下午才有人来访问的话,程序就会把这两天当作一天了,jsqtoday就不会归为1而是累加了。
这里应该改为:
if application("dntime")=year(now())*10000+month(now())*100+day(now()) then

下边存储时间值时,也改为这样!




上边的话是百度搜索得到的,对么 ?
#7
fireing2008-05-02 06:15
[bo]以下是引用 [un]bjbaima[/un] 在 2008-4-30 16:02 的发言:[/bo]

if application("dntime")

这样修改的结果,值只能=1
#8
fireing2008-05-02 12:13
自己顶一个,求救
自己顶一个,求救
#9
fireing2008-05-02 13:31
这个是我在百度里面搜索的一个(共参考)
但还是不对。
http://zhidao.baidu.com/question/26173946.html
1