【 tulaoshi.com - ASP 】
                             
                                   使用Session来保持对斑竹的身份验证,这必须要求客户端浏览器的cookie被打开了。因为Session是通过cookie来实现的。在这儿,把看板ID赋给Session变量beenthere,表明斑竹已经通过了身份验证。在后面的每个版务处理的页面中,都要检查beenthere是否和相应的看版ID相符。         
      url="boardmanager.asp?boardid=" & boardid     
      response.redirect url     
      初学ASP的时候总是为response.redirect这个方法感到困惑,屡用不爽,现在我来告诉你一些技巧。使用它之前,必须通过response.buffer=true来让ASP页面使用缓冲区。这时,在ASP被解释成HTML代码之前,它是放在缓冲区中的,而不直接被发送的客户端浏览器。还有一个必须要知道的是:在使用response.redirect之前,是不能有任何实际的HTML代码被发送到客户端浏览器的,否则就会出错。当然也有变通的方法,如果在response.redirect之前已经有HTML代码被解释出来,可以用response.clear方法来清除缓冲区,然后就可以使用它来进行重定向了。         
      end if     
      %                 
       下面的页面,就是在上面身份验证通过后重定向的目标:boardmanager.asp。它将列出了所有别有被处理的文章。         
      < %     
      boardid=request("boardid")     
      if session("beenthere")< boardid then response.redirect     "forums.asp"     
      这就是检验斑竹身份的地方,因为前面已经通过cookie在斑竹的浏览器中作了标记,现在我们就能够通过seesion来辨认斑竹的身份了。如果标志不符,就会通过response.redirect返回到最开始的登陆页面。如果斑竹浏览器的cookie没有打开,那么seesion(“beenthere“)的值会为空,同样也无法进入这个页面。         
      Set conn = Server.CreateObject("ADODB.Connection")     
      conn.Open "driver={Microsoft Access Driver (*.mdb)};dbq=" &     Server.MapPath("bbssystem.mdb")     
      Set cmd = Server.CreateObject("ADODB.Command")     
      Set cmd.ActiveConnection = conn     
      sql="select 名称 from 看板列表 where id=" & boardid     
      set rs=conn.execute(sql)     
      boardname=rs("名称")     
       cmd.commandtext="未发表文章列表"     
       ReDim param(0) ' 声明     
      param(0) = CLng(boardid) ' Cint 不可忽略     
      Set rs = cmd.Execute( ,param )     
      set cmd=nothing     
      %     
      < html     
      < head     
      < title版务处理< /title     
      < meta http-equiv="Content-Type" content="text/html;     charset=gb2312"     
      < /head     
      < body bgcolor="#FFFFFF"     
      < h1 align="center"< %=boardname%板板务管理< /h1         
      < hr     
      < %     
      if rs.eof or rs.bof then response.write "< H2现在没有文章要处理<     /h2"     
      response.end     
      %     
       如果没有新文章被网友发布,这给出相应的提示,并用response.end来结束此页的显示。         
      < table width="90%" border="0" cellspacing="0"     cellpadding="0" align="center"      
       < tr bgcolor="#FFFFCC"     
       < td width="40%" height="20"主题< /td     
       < td width="40%" height="20"文章标题< /td     
       < td width="8%" height="20"作者< /td     
       < td width="12%" height="20"日期< /td     
       < /tr     
       < %     
      do     
      topicid=rs("主题id")     
       articleid=rs("文章id")     
       data=rs("日期")     
      datastr=cstr(yea