ASP实现每天自动生成首页的解决方法

    虽然现在ASP用得很少了,不过其简洁的逻辑我还是很喜欢用的。入门低正是我喜欢的。哈,从没有去专门学习过程序开发方面的,但见多了,现在也懂得一点点。下面收藏一段代码,包括了采集功能和生成功能。

    Server.ScriptTimeOut = 9999
    set urs=Server.CreateObject("ADODB.RecordSet")
    Sql="select * from config"
    urs.open sql,conn,3,3
    if not urs.EOF then
    upstart=urs("upstart") '采集开始时间
    upend=urs("upend") '采集结束时间
    makestart=urs("makestart") '生成首页开始时间
    makeend=urs("makeend") '生成首页结束时间
    upday=urs("update") '完成所有更新生更新为今日时间
    else
    urs.addnew
    end if

    ndate=date
    make=0
    if upday<>ndate then '对比数据库中的上次更新时间,不同时即开始更新
    if upend<>ndate then '对比上次采集时间,如果是今天,说明采集已经完成
    if (now-upstart)*60*60>10 then '对比上次开始采集时间,如果少于10分钟,可能上回的采集程序还在运行,只是太慢,避免每个访客访问都采集。
    urs("upstart")=now
    urs.update
    getbaidu() '抓取百度关键词的函数
    urs("upend")=date '采集完成,更新数据库中时间
    urs("makestart")=now '开始生成
    urs.update
    createhome() '生成首页
    urs("makeend")=date
    urs("update")=date
    urs.update
    end if
    make=1
    end if
    if makeend<>ndate and make=0 then '对比数据库中的生成时间及是否已经进行了刚才的步骤。
    if (now-makestart)*60*60>10 then '对比上次开始生成时间,10分钟没生成才开始生成首页
    urs("makestart")=now
    urs.update
    createhome() '生成首页
    urs("makeend")=date
    urs("update")=date '生成成功
    urs.update
    end if
    end if
    end if
    urs.close
    set urs=nothing

相关文章
asp全站防止注入的代码今天自已做了个用ASP调用雪人论坛的叶子显示godaddy asp空间详细错误信息的方法asp去除html标记与空格的正则ASP+XMLHTTP检测文件是否存在(掉链)关于使用aspjpeg的注意事项ASP与PHP读取多张表(多张表的操作)最近给ASP木马害苦了构建免受Fso威胁Windows虚拟主机通过MyODBC,用ASP操作MYSQL
    标签:ASPfso自动 发布于:2009-11-13 21:43:46

当前共有0条评论,我也要发表:

    我的名字:

    我的邮箱: