📄 article.asp
字号:
<!--#include file="inc/config.asp"-->
<!--#include file="inc/conn.asp"-->
<!--#include file="inc/code.asp"-->
<!--#include file="inc/inc.asp"-->
<!--#include file="inc/new.asp"-->
<!--#include file="inc/SqlIn.Asp"-->
<!--#include file="inc/format.asp"-->
<%call head()%>
<body>
<div id="top-bg">
<div id="public-body">
<!--#include file="Top.asp"-->
<div id="page-link">
<%
start="技术文章"
dim founderr
founderr=false
if request.querystring("cat_id")<>"" then
if not isInteger(request.querystring("cat_id")) then
founderr=true
Response.Write "<script language=javascript>alert('参数非法');javascript:history.back();</script>"
end if
end if
if request("page")<>"" then
if not isInteger(request("page")) then
founderr=true
Response.Write "<script language=javascript>alert('参数非法');javascript:history.back();</script>"
end if
end if
if request("keyword")<>"" then
if instr(request("keyword"),"'")>0 then
founderr=true
Response.Write "<script language=javascript>alert('搜索参数非法');javascript:history.back();</script>"
end if
end if
dim totalart,Currentpage,totalpages,i,j,colname
sql="select id,cat_id,art_title,art_date,art_count,content,isbest from Gq_article order by id DESC"
if request("cat_id")<>"" then
sql="select id,cat_id,art_title,art_date,art_count,content,isbest from Gq_article where cat_id="&request("cat_id")&" order by id DESC"
elseif request("keyword")<>"" then
sql="select id,cat_id,art_title,art_date,art_count,content,isbest from Gq_article where "&request("select")&" like '%"&request("keyword")&"%'order by id DESC"
end if
set rs=server.createobject("adodb.recordset")
rs.open sql,conn,1,1
%>
<table width="984" border="0" align="center" cellspacing="0">
<tr>
<td background="index_img/Index_c1_r5.jpg"><%
response.write "<TABLE cellSpacing=5 cellPadding=0>" & vbCrLf
response.write "<TR>" & vbCrLf
response.write "<TD height='22'><a href='article.asp'><font color='#000000'>文章首页</font></a>" & vbCrLf
sql="select cat_id,cat_name from Gq_newsClass"
set rs2=server.createobject("adodb.recordset")
rs2.open sql,conn,1,1
do while not rs2.eof
if request("cat_id")=cstr(rs2("cat_id")) then
response.write " <font color='#000000'>│</font> <font color='#000000'>"&rs2("cat_name")&"</font>"
else
response.write " <font color='#000000'>│</font> <a href='?cat_id="&rs2("cat_id")&"'><font color='#000000'>"&rs2("cat_name")&"</font></a>"
end if
rs2.movenext
loop
if rs2.eof and rs2.bof then
response.write "当前没有分类!"
end if
response.write "</TD></TR></TBODY></TABLE>" & vbCrLf
%></td>
</tr>
</table>
<TABLE width=984 border=1 align=center cellPadding=0 cellSpacing=1 bordercolor="#990000">
<TBODY>
<TR>
<TD width="240" vAlign=top><table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="231" height="28" align="center" bgcolor="#FF9900"><span style="color: #FFFFFF; font-weight: bold;">文章搜索</span></td>
</tr>
<tr height="3">
<td height="3" width="231"></td>
</tr>
<tr>
<td valign="top"><table width="100%" border="0" cellspacing="5" cellpadding="0">
<tr>
<td height="47" valign="top"><form name="form2" method="post" action="article.asp">
<input type="radio" name="select" value="art_title" checked>
标题
<input type="radio" name="select" value="art_content">
内容 <br>
<br>
<input type='text' name='keyword' size='20' value='搜索关键字' maxlength='50' onFocus='this.select();'>
<input type='submit' name='search' value='搜 索'>
</form></td>
</tr>
</table></td>
</tr>
</table>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="195" height="28" align="center" bgcolor="#FF9900"><span style="color: #FFFFFF; font-weight: bold;">热门文章</span></td>
</tr>
<tr height="3">
<td height="3" width="195"></td>
</tr>
<tr>
<td valign="top">
<%
set rs3=server.createobject("adodb.recordset")
sql="select top 10 id,art_title,art_count,cat_id,art_date from Gq_article order by art_count DESC"
rs3.open sql,conn,1,1
do while not rs3.eof
%>
<TABLE cellSpacing=1 cellPadding=1 width="98%" border=0 align="center">
<TR>
<TD height="20" valign="middle"><img src="index_img/t_pu.gif" width="19" height="17"><a href='showarticle.asp?cat_id=<%=rs3("cat_id")%>&id=<%=rs3("id")%>' target='_blank' Title='文章标题:<%=rs3("art_title")%>
发表时间:<%=rs3("art_date")%>
阅读次数:<%=rs3("art_count")%>次'><font color="#333333"><%=left(rs3("art_title"),15)%>...</font></a></TD>
</TR>
</TABLE>
<%
rs3.movenext
loop
if rs3.eof and rs3.bof then
response.write "<div align=center><br>当前没有热门文章<br><br></div>"
end if
rs3.close
set rs3=nothing
%>
</td>
</tr>
</table></TD>
<TD width="754" vAlign=top><TABLE cellSpacing=0 cellPadding=0 width="100%" border=0>
<TBODY>
<TR>
<TD height="91" valign="top">
<table width="100%" border="1" align="center" cellspacing="0" cellpadding="3" bordercolor="#FFFFFF">
<tr>
<td width="74%" height="28" align="center" bgcolor="#FF9900" ><b><font color="FFFFFF">文章标题</font></b></td>
<td align="center" bgcolor="#FF9900" ><b><font color="FFFFFF">人气</font></b></td>
<td align="center" bgcolor="#FF9900" ><b><font color="FFFFFF">更新时间</font></b></td>
</tr>
<tr height="3">
<td height="3" ></td>
<td height="3" ></td>
<td height="3" ></td>
</tr>
<%
if not rs.eof then
rs.movefirst
rs.pagesize=MaxPerPage
if trim(request("page"))<>"" then
currentpage=clng(request("page"))
if currentpage>rs.pagecount then
currentpage=rs.pagecount
end if
else
currentpage=1
end if
totalart=rs.recordcount
if currentpage<>1 then
if(currentpage-1)*MaxPerPage<totalart then
rs.move(currentpage-1)*MaxPerPage
dim bookmark
bookmark=rs.bookmark
end if
end if
if (totalart mod MaxPerPage)=0 then
totalpages=totalart\MaxPerPage
else
totalpages=totalart\MaxPerPage+1
end if
i=0
do while not rs.eof and i<MaxPerPage
sql="select cat_id,cat_name from Gq_newsclass where cat_id="&rs("cat_id")
set rscat=server.createobject("adodb.recordset")
rscat.open sql,conn,1,1
%>
<tr>
<td width="74%"><img src="index_img/t_pu.gif" width="19" height="17"> [<a href="?cat_id=<%=rscat("cat_id")%>"><%=rscat("cat_name")%></a>] <a href='showarticle.asp?cat_id=<%=rs("cat_id")%>&id=<%=rs("id")%>' target='_blank' Title='文章标题:<%=rs("art_title")%>
发表时间:<%=rs("art_date")%>
阅读次数:<%=rs("art_count")%>次'><%=left(rs("art_title"),60)%>...</a></td>
<TD width="10%" align=Center><%=rs("art_count")%></TD>
<td width="16%" align="center">
<%if Rs("art_date")>=date() then
Response.Write "<FONT color=""#FF0000"">"&year(Rs("art_date"))&"-"&month(Rs("art_date"))&"-"&day(Rs("art_date"))&"</FONT >" & vbCrLf
else
Response.Write "<FONT color=""#999999"">"&year(Rs("art_date"))&"-"&month(Rs("art_date"))&"-"&day(Rs("art_date"))&"</FONT >" & vbCrLf
end if
%></td>
</tr>
<%
i=i+1
rs.movenext
loop
else
if rs.eof and rs.bof then
%>
<tr align="center">
<td align=middle height="26" colSpan=4>
<%if request("cat_id")<> "" then%>
该分类暂时没有文章
<%elseif request("keyword")<>"" then%>
没有找到包含[<b><font color=red><%=request("keyword")%></font></b>]的文章!
<%else%>
没有任何文章,请管理员到后台添加!
<%end if%></td>
</tr>
<%end if
end if%>
</table>
<br>
<form name="form1" method="post" action="article.asp?select=<%=request("select")%>&keyword=<%=request("keyword")%>&cat_id=<%=request("cat_id")%>">
<TABLE width="100%" border=0 align=center>
<TBODY>
<TR>
<TD height=20 align=center valign="middle"> <IMG height=14 src="index_img/so.gif" width=14 align=absMiddle> 共[<font color="#FF6666"><%=totalart%></font>]篇文章 分[<font color="#FF6666"><%=totalpages%></font>]页 <IMG height=11 src="index_img/lt.gif" width=11 align=absMiddle>
<%
if CurrentPage<2 then
response.write "<font color='999966'>首页 上一页</font> "
else
response.write "<a href=article.asp?page=1&cat_id="&request.querystring("cat_id")&">首页</a> "
response.write "<a href=article.asp?page="&CurrentPage-1&"&cat_id="&request.querystring("cat_id")&">上一页</a> "
end if
if totalpages-currentpage<1 then
response.write "<font color='999966'>下一页 尾页</font>"
else
response.write "<a href=article.asp?page="&CurrentPage+1&"&cat_id="&request.querystring("cat_id")
response.write ">下一页</a> <a href=article.asp?page="&totalpages&"&cat_id="&request.querystring("cat_id")&">尾页</a>"
end if
%>
<IMG height=11 src="index_img/rt.gif" width=11 align=absMiddle>
<select name="page" class="guiqi">
<%
i=1
for i=1 to totalpages
if i=currentpage then
%>
<option value=<%=i%> selected>第<%=i%>页</option>
<%else%>
<option value=<%=i%>>第<%=i%>页</option>
<%end if
next%>
</select>
<input type="submit" name="Submit2" value="转向"> </TD>
</TR>
</TBODY>
</table>
</form></TD>
</TR>
<TR>
<TD height=3></TD>
</TR>
</TBODY>
</TABLE></TD>
</TR>
</TBODY>
</TABLE>
<%
rs2.close
set rs2=nothing
call footer()
call CloseConn()%>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -