index.asp

来自「类似于baidu的百度知道」· ASP 代码 · 共 294 行

ASP
294
字号
<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<!--#include file="inc/conndb.asp"-->
<!--#include file="inc/function.asp"-->
<%
Dim titlenum,keys,act,boardid,iskey,isact,isboardid,kkkj,boardname,boardadmin00,boardyes,boardadmin,tdim00,bz,CurPage,isup
titlenum=70'这里设置字数
keys = formatQueryStr(Request.QueryString("keys"))
act=Request.QueryString("act")
'分类功能
boardid=CInt(Request.QueryString("boardid"))
If keys<>"" Then iskey="&keys="&keys
If act<>"" Then isact="&act="&act
If boardid="" Then boardid=0
If boardid<>"" Then isboardid="boardid="&boardid

If boardid=0 Then
		fl=" IsCheck>0 "
	Else 
		fl=" IsCheck>0 and boardid="&boardid
		'从缓存中读出吧的相关信息
		For kkkj=1 To Application(webname&"boardcount")
				'开始循环
				If boardid=Application(webname&"board_id"&kkkj) Then
					boardname=Application(webname&"board_name"&kkkj)
					boardadmin00=Application(webname&"board_admin"&kkkj)
					boardyes=1
				Exit For
				End If
				
		Next
		If boardyes<>1 Then Call backmsg("对不起,没有此分类!请确认","")
		If boardadmin00<>"" Then
			boardadmin=" 版主:"&Replace(boardadmin00,"|"," ")
			If Dreamsun_name<>"" And isadmin<>9 Then 
				tdim00=split(boardadmin00,"|")
				for bz=0 to ubound(tdim00)
					If Dreamsun_name=tdim00(bz) Then isadmin=1 '斑竹是1,高官是9
				next
			End If

		Else
			If boardid<>"" And boardid<>"0" Then  boardadmin=" 暂无版主"
		End if
End if
'判断参数
If (act="title" Or act="username" Or act="content") And keys="" Then response.write backmsg("搜索关键字不能为空","")
	If Request("CurPage") = "" or Request("CurPage") = 0 then
		CurPage = 1
			Else
		CurPage = CINT(Request("CurPage"))
	End If
's数据读取条件
Select Case isup
	Case "0"'不根据最后回复时间排序
		isups="addtime"
	Case "1" '根据最后回复时间排序
		isups="retime"
End Select 

Select Case act
	Case "jinghua"'精华
		jh=" and isgood=1"
	Case "title" '搜索的标题
		jh=" and title like '%"&keys&"%'"
	Case "username" '搜索的用户
		jh=" and username like '%"&keys&"%'"
	Case "content" '搜索的用户
		jh=" and content like '%"&keys&"%'"

	Case "recount"'回复排行榜
		isups="recount"
	Case "hits"'点击排行榜
		isups="hits"
End Select

'2007.4.11新增加是否从回复中搜索信息
If keys<>"" Then 
	allreplies=Request.QueryString("allreplies")
	If allreplies=1 Then inreplys=" or b.id in (Select re from "&rebbstable&" where ischeck>0 "&jh&")"
End If 
Dim title,username,addtime,retime,rename
SQL = "SELECT b.id,b.title,b.addtime,b.retime,b.isgood,b.istop,b.hits,b.recount,b.rename,b.username,b.titlecolor,b.titlebold,b.boardid as boardid,t.board_name as board_name FROM "&bbstable&" as b,"&boardtable&" as t where (("&fl&" "&jh&")"&inreplys&") and b.boardid=t.board_id ORDER BY b.istop desc,b."&isups&" DESC" 
'response.write sql
Set rs = Server.CreateObject("ADODB.Recordset")
rs.open sql,conn,1,1
RS.PageSize=indexnum'设置每页记录数           
Dim TotalPages              
TotalPages = RS.PageCount              
	If CurPage>RS.Pagecount Then               
	CurPage=RS.Pagecount              
	end if              
RS.AbsolutePage=CurPage
rs.CacheSize = RS.PageSize'设置最大记录数  
Dim Totalcount              
Totalcount =INT(RS.recordcount)              
StartPageNum=1              
do while StartPageNum+10<=CurPage              
	StartPageNum=StartPageNum+10              
	Loop              
EndPageNum=StartPageNum+9              
If EndPageNum>RS.Pagecount then EndPageNum=RS.Pagecount
I=0
p=RS.PageSize*(Curpage-1)   
'------------------------------------------开始进行列表输出----------------------------------------------------
showlist="<DIV class=tiebalist>"& vbCrLf
showlist=showlist&"<DIV class=tl1><a href=""index.asp?act=hits&"&isboardid&""">阅读</A></DIV>"& vbCrLf
showlist=showlist&"<DIV class=tl1><a href=""index.asp?act=recount&"&isboardid&""">回复</A></DIV>"& vbCrLf
showlist=showlist&"<DIV class=tl2>主题</DIV>"& vbCrLf
showlist=showlist&"<DIV class=tl3>作者</DIV>"& vbCrLf
showlist=showlist&"<DIV class=tl4>时间</DIV>"& vbCrLf
showlist=showlist&"<DIV class=tl3>回复</DIV>"& vbCrLf
showlist=showlist&"</DIV>"& vbCrLf
If rs.eof and rs.bof Then
showlist=showlist&"<DIV class=tiebatitle>"& vbCrLf
showlist=showlist&"<DIV class=tt1>0</DIV>"& vbCrLf
showlist=showlist&"<DIV class=tt1>0</DIV>"& vbCrLf
showlist=showlist&"<DIV class=tt2>暂无 <font color=red>"&keys&"</font> 相关的内容,或作者的帖子,感谢支持本帖吧!</DIV>"& vbCrLf
showlist=showlist&"<DIV class=tt3> </DIV>"& vbCrLf
showlist=showlist&"<DIV class=tt4>"&Now()&"</DIV>"& vbCrLf
showlist=showlist&"<DIV class=tt3> </DIV>"& vbCrLf
showlist=showlist&"</DIV>"& vbCrLf
Else     
	do while (Not RS.Eof) and (I<RS.PageSize)              
		p=p+1
		hitss=Rs("Hits")
		if hitss > hothits Then hitss="<span class=hotcolor><b>"&hitss&"</b></span>"
		recount=Rs("recount")
		if recount > hotrehits Then recount="<span class=hotcolor><b>"&recount&"</b></span>"
		If boardid=0 Then
			fenlei="[<a href=index.asp?boardid="&rs("boardid")&">"&rs("board_name")& "</a>] "
			tnum=Int(titlenum)-Len(rs("board_name"))-2
		Else
			tnum=titlenum
		End If 
		title=TitleLeft(DropFuckWords(CStr(Rs("title"))),tnum)
		if Rs("TitleColor")<>"" Then title="<font color="&Rs("TitleColor")&">"&title&"</font>"
		'Add by zidone for Version 1.1 Dev
		if CInt(Rs("titleBold"))=1 Then title="<B>" & title & "</B>"
		if Rs("isTop")=1 Then title="<font color=#ff0000>[置顶]</font>"&title
		if Rs("isGood")=1 Then title=title&"<font color=#ff0000>[精华]</font>"
		username=DropFuckWords(LCase(Rs("username")))
		username2=LCase(Rs("username"))
			If ubound(split(username,"."))<3 And instr(username,".*")=0 And ((Dreamsun_Name<>"" And isuserinfo=0) Or isuserinfo=1) Then
				username = "<a href=user.asp?Action=infoshow&username="&username2&">"& username &"</a>"
			End If 
		retime=Rs("retime")
		addtime=FormatDateTime(rs("addtime"),2)
		If IsNull(Rs("rename")) Or Rs("rename")=""  Then
			rename="暂无"
		Else 
			rename=DropFuckWords(Trim(LCase(Rs("rename"))))
			rename2=LCase(Trim(Rs("rename")))
			If ubound(split(rename2,"."))<3 And instr(rename2,"*")=0 And ((Dreamsun_Name<>"" And isuserinfo=0) Or isuserinfo=1) Then
				rename="<a href=user.asp?Action=infoshow&username="&rename2&">"&rename&"</a>"
			End If 
		End If 
showlist=showlist&"<DIV class=tieba onmouseover=""this.className='ahover'"" onmouseout=""this.className='tieba'""><DIV class=tiebatitle >"& vbCrLf
showlist=showlist&"<DIV class=tt1>"&hitss&"</DIV>"& vbCrLf
showlist=showlist&"<DIV class=tt1>"&recount&"</DIV>"& vbCrLf
showlist=showlist&"<DIV class=tt2 style=""WIDTH: 57%;TEXT-ALIGN: left"">"&fenlei&"<a href=""show.asp?id="&Rs("id")&"""  title="""&DropFuckWords(CStr(Rs("title")))&""">"&title&"</a></DIV>"& vbCrLf
showlist=showlist&"<DIV class=tt3>"&username&"</DIV>"& vbCrLf
showlist=showlist&"<DIV class=tt4>"&addtime&"</DIV>"& vbCrLf
showlist=showlist&"<DIV class=tt3 title=""最后回复:"&retime&""">"&rename&"</DIV>"& vbCrLf
showlist=showlist&"</DIV></DIV>"& vbCrLf
		I=I+1              
		RS.MoveNext
	Loop
	showlist=showlist&"<div class=viewpage><div>"&viewpage(Totalcount, indexnum,"10",CurPage,isboardid&isact&iskey,"当前总数:","index.asp")&"</div></div>"& vbCrLf
 '总记录,显示记录数,显示页数,当前页,传替参数,总数说明,当前页面名称
End If

rs.close
set rs=nothing
'------------------------------------------开始进行 导航条 输出----------------------------------------------------
ggg=boardname&"第"&curpage&"页"
If boardid<>"0" Then navdh=navdh&boardname&" &gt;&gt; " 
if keys="" then
	navdh=navdh&"帖子列表" 
else
	navdh=navdh&"搜索关键字:"&keys 
end If
webtitle="图文快印技术交流帖吧"
navright="本版共有主题 <FONT color=#ff0000>"&Totalcount&"</FONT> 篇 &nbsp;"&boardadmin&"  吧主:"&sysManager
Call showpage()
Sub pagecontent()
%> 
<div id="cp">
	<DIV id="cp-left">
			<a href="#new"><img src="<%=indeximg%>/nav_post.gif" width="72" height="24" border="0"></a> <a href="index.asp?act=jinghua&<%=isboardid%>"><img src="<%=indeximg%>/nav_good.gif" width="52" height="24"border="0"></a> <a href="help.htm"><img src="<%=indeximg%>/nav_help.gif" width="72" height="24" border="0"></a>
	</DIV>
	<div id="cp-center"><%=GetPlugIn("DDP_Marquee(left,scroll,5)")%></div>
	<div id="cp-right"><% Call boardlist()%></div>
</div>
<DIV id="content">
<div id="content-left"><%=showlist%></div>
</DIV>
<DIV id="write">
		<%
'------------------------------------------'开始进行发贴判断----------------------------------------------------
If (Dreamsun_name="" And guestadd=1) Or Dreamsun_name<>""  Then %>
		<form name="save" method="post" action="tzsave.asp?cz=addsave" onSubmit="return regcheck(this);" class=postform>
            <%If boardid<>"0" Then  %>
			<input name="boardid" type="hidden" id="boardid" value="<%=boardid%>">
			<% Else %>
			<DIV class="bo"><strong>贴吧名:</strong><% Call boardselect()%></DIV>
			<% End If %>
<DIV class="bo"><LABEL for=title><strong>标 题:</strong></label><input name="title" type="text" id="title" size="50" maxlength="50" style="color:#000000">
<%If Dreamsun_name<>"" And Isadmin<>"" Then %>					<input type="radio" name="titleBold" value="0" checked id="titleBold1"><label for="titleBold1">正常</label>
					<input type="radio" name="titleBold" value="1" id="titleBold2"><label for="titleBold2">粗体</label>
</DIV>

			<DIV class="bo"><script language=JavaScript src="images/title_color.js"></script>
                <TABLE id=ColorPanel cellSpacing=0 cellPadding=0 border=0>
                  <TBODY>
                    <TR>
                      <TD id=ColorUsed 
                     onclick="if(this.bgColor.length > 0) insertTag(this.bgColor)" 
                     vAlign=center align=middle> <strong>标题色:</strong></TD>
                      <SCRIPT language=JavaScript>rgb(pas,width1,height1)</SCRIPT>
                    </TR>
                  </TBODY>
              </TABLE><input name="titlecolor" type="hidden" id="titlecolor"><% End If %>
</DIV>

<DIV class="bo" style="padding-left: 80px;"><!--#include file="inc/ubb.asp" --></DIV><div id="clear"></div>
<DIV class="bo"><strong><a name="new"></a>内 容:</strong><textarea name="content" cols="60" rows="5" id="contents" title='Ctrl+Enter快速提交' onSelect="javascript: storeCaret(this);" onClick="javascript: storeCaret(this);" onKeyUp="javascript: storeCaret(this);"></textarea></DIV>
<DIV class="bo"><strong>作 者:</strong><%
if Dreamsun_name= "" then
response.write"您目前是匿名发表 <A href='user.asp'>登录</A> | <A href='user.asp?Action=reg'>注册</A>"
else
response.write Dreamsun_name&" | <A href='user.asp?Action=exit'>退出</A>"
end if
%> </DIV>
<%if Dreamsun_name="" then%>
<DIV class="bo"><strong>验证码:</strong><input name="zd_code" type="text" id="zd_code" size="4" maxlength="4" onKeyPress="if ((event.keyCode<48 || event.keyCode>57)) event.returnValue=false"> 
                <img src="inc/GetCode.asp?a=index" alt= "验证码,看不清楚?请点击刷新验证码" style="cursor : pointer;" onClick="this.src='inc/GetCode.asp?a=index'"></DIV>
<%end if%>
<DIV class="bo">
<tr>
              <td align="right"><strong>传 图:</strong></td>
              <td align="left"><iframe name=ad frameborder=0 width=100% height=24 scrolling=no src="upload.asp"></iframe></td>
            </tr></DIV>
<DIV class="bo"><input type="submit" name="Submit" value="发表帖子">
      &nbsp;&nbsp;      <input type="reset" name="Submit" value="重新填写"> [Ctrl] + [Enter]直接提交帖子</DIV>
<DIV class="bo">	<font color=gray>发帖请遵守《计算机信息网络国际联网安全保护管理办法》、《互联网信息服务管理办法》、《
	互联网电子公告服务管理规定》、《维护互联网安全的决定》等法律法规。</font></DIV>
 </form> 
		<%
		Else 
			response.write "<BR><BR><CENTER>目前不允许游客发表新贴,请 <A href='user.asp'>登录</A> <A href='user.asp?Action=reg'>注册</A> 发贴.</CENTER><BR><BR>"
		End If 
		'------------------------------------------'发帖区域结束----------------------------------------------------
		%> 
<script language="JavaScript"> 
<!-- 
document.onkeydown=function up(){ 
if(event.ctrlKey&&event.keyCode==13) 
document.save.submit(); 
} 
//--> 
// 发帖时验证帖子内容是否完整
function regcheck(formct){
	if (formct.boardid.value=='' ){
		alert('请您选择要发布的贴吧名.');
		return false; 
	}
	if (formct.title.value=='' ){
		alert('标题不能为空,请填写.');
		return false; 
	}
		if (formct.content.value=='' ){
		alert('内容不能为空,请填写..');
		return false; 
	}
<%if Dreamsun_name="" then%>
		if (formct.zd_code.value=='' ){
		alert('验证码不能为空,请填写.');
		return false; 
	}
<% end if%>
	formct.Submit.disabled=true;
	return true;
}
</script>
<%
If iscallonline=1 Then Call Dreamsun_onliner()
End Sub
%>
</DIV>
<DIV style="text-align:center;">
<script language="javascript" type="text/javascript" src="http://js.users.51.la/761046.js"></script>
<script src="../myweb/count/count.asp?view=girlsafe&fy=1"></script>
</DIV>

⌨️ 快捷键说明

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