⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 index.asp

📁 网易论坛 发表新贴子
💻 ASP
字号:
<%@ Language=VBScript %>
<!--#include file="opendb.asp"-->
<html>
<head>
 <title>网站简易论坛</title>
 <meta http-equiv="content-type" content="text/html; charset=gb2312">
 <link href="images/style.css" rel="stylesheet">
</head>
<script language=vbscript src="images/function.vbs"></script>  
<body>
  <table  cellspacing="0" cellpadding="0" width="99%" align="center" border="0">
   <tr><td valign="top" align="left" rowspan="2"><img src="images/logo.gif" border="0"></td></tr>
   
  </table>
  <table cellspacing=4 cellpadding=0 width="97%" align=center border=0>
    <tr>
     <td>
      <%if session("UserName")="" then %> 
        <font color=red>您现在的身份是游客,请您登录或注册</font>
        <input type=button class="buttonface" value="用户登录" onclick="userlogon()">
        <input type=button class="buttonface" value="新用户注册" onclick="newuserlogin()" >
      <%else%>
        欢迎光临<%=session("UserName")%>
        <%if session("UserName")="admin" then%>
           <a href="#">[用户管理]</a><a href="#">[帖子管理]</a> 
        <%end if%>
        <a href="#" onclick="pwdmodify()">[密码修改]</a><a href="exitforum.asp">[退出论坛]</a>
      <%end if%>
      </td>
      <td align=right><input type=button class="buttonface" value="发表新贴" onclick=newart()></td>
    </tr>
    <tr>
      <td colspan =2 align=left>现在时间:<%=date()&time()%></td>
      
    </tr>
  </table>
  <table cellspacing=0 cellpadding=0 width="99%" align=center bgcolor=#000000 border=0>
    <tr>
     <td>
      <table cellspacing=1 cellpadding=4 width="100%" border=0>
       <tr class=header>
         <td align=center width="9%">编号</td>
         <td align=center width="46%">标题</td>
         <td nowrap align=center width="14%">作者</td>
         <td nowrap align=center width="6%">回复</td>
         <td nowrap align=center width="6%">查看</td>
         <td align=center width="19%">发贴时间</td>
       </tr>
       <%
         '利用Select语句在表Forum中筛选字段AnswerID等于0的所有记录(字段AnswerID=0表示该帖子不是回帖),使用通配符“*”来选择每条记录中的所有字段,筛选返回的记录按照字段值CreateTime进行降序排列
         strSQL = "Select * from Forum Where AnswerID=0 Order By CreateTime DESC" 
         '设置指针类型为“静态指针”,静态指针常用于寻找和建立记录
         rst.CursorType=3
         '使用Recordset对象的Open方法打开记录集
         rst.open strSQL
         '如果rst.RecordCount的值大于0,表示返回的记录集不为空,即存在符合条件的记录
         if rst.RecordCount>0 then
          '设置Recordset对象的pagesize属性的值,来控制每页显示的记录数目
          rst.pagesize=10
          '参数page用来指定当前的页码
          page=clng(Request.QueryString("page"))
          '如果当前页码小于1,则设置当前页码为1
          if page<1 then page=1
          'Recordset对象的pagecount属性可以返回记录集中包含的总页数。如果设置了属性pagesize的值,属性pagecount的值也就确定。
          '如果当前页码大于总页数,则设置当前页面为总页数
          if page>rst.pagecount then page=rst.pagecount
          '使用Recordset对象的absolutepage属性来设置当前记录所在的页
          rst.absolutepage=page
          '使用For...Next循环来显示每页中的记录
          for i=1 to rst.pagesize
            '利用Recordset对象的eof属性来判断当前记录的位置是否位于Recordset对象的最后一条记录之后。如果是,退出for循环
            if rst.eof then 
	          exit for
	        else   
       %>
            <tr>
             <td align=center bgcolor=#ffffff><%=i%></td>
             <td bgcolor=#ffffff><a href="detail.asp?index=<%=rst("ID")%>"><%=rst("Title")%></a></td>
             <td align=center bgcolor="#f8f8f8"><%=rst("Username")%></td>
             <td align=center bgcolor=#ffffff><%=rst("AnswerCount")%></td>
             <td align=center bgcolor=#f8f8f8><%=rst("HitCount")%></td>
             <td bgcolor=#ffffff><%=rst("CreateTime")%></td>
            </tr>
       <%
		    end if
		    '使用Recordset对象的movenext方法将记录指针移向下一条记录
		    rst.movenext
          next
         end if            
	   %>      
       <tr>
         <td colspan=6 bgcolor="#f8f8f8" align=center>
           <a href="index.asp?page=1">[第一页]</a> 
           <a href="index.asp?page=<%=(page-1)%>">[上一页]</a>
           <a href="index.asp?page=<%=(page+1)%>">[下一页]</a> 
           <a href="index.asp?page=<%=rst.pagecount%>">[最后一页]</a>
         </td>
       </tr> 
      </table> 
  </table>	
</body>
</html>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -