📄 syscode_web.asp
字号:
<%
'****************************************************
if guestart<>"yes" and UserLogined<>True then
call guesterror()
response.end
end if
dim art_id,cat_id,art_title,art_images,art_imgyes
dim founderr,errmsg,RsHxcms
art_id=trim(request.querystring("art_id"))
if art_id<>"" then
if not isInteger(art_id) then
FoundErr=True
ErrMsg=ErrMsg & "<br><li>非法的文章ID参数!</li>"
end if
art_id=CLng(art_id)
else
art_id=0
end if
if request.querystring("cat_id")<>"" then
if not isInteger(request.querystring("cat_id")) then
Response.Redirect "show_error.asp?eid=传值参数非法!"
Response.End
end if
cat_id=CLng(request("cat_id"))
else
cat_id=0
end if
if art_id>0 then
sql="select * from web where art_id="&art_id
set rs=server.createobject("adodb.recordset")
rs.open sql,conn,1,3
if rs.bof and rs.eof then
FoundErr=True
ErrMsg=ErrMsg & "<br><li>你要找的文章不存在,或者已经被管理员删除!</li>"
else
if rs("Passed")=1 then
FoundErr=True
ErrMsg=ErrMsg & "<br><li>你要找的文章尚未被管理员审核!</li>"
else
start="旅游手记中心 - "&rs("art_title")&""
cat_id=CLng(rs("cat_id"))
art_title=rs("art_title")
art_images=rs("images")
art_imgyes=rs("imgyes")
rs("art_count")=rs("art_count")+1
rs.update
end if
end if
end if
if FoundErr=True then
Call HxErrMsg()
response.end
end if
'=================================================
'过程名:new_art
'作 用:最新文章
'参 数:n-调用条数,nn-显示长度
' NewWindows-----是否新窗打开,True为是,False为否
'Web: www.ynsky.com.cn
'=================================================
sub new_art(n,nn,NewWindows)
dim nnn
if NewWindows=True then
nnn="target='_blank'"
else
nnn=""
end if
Response.Write "<TABLE width='100%' cellSpacing=0 cellPadding=0 border=0 align='center'>" & vbCrLf
set RsHxcms=server.createobject("adodb.recordset")
set RsHxcms=conn.execute("select top "&n&" * from web where passed=0 order by art_id desc")
do while not RsHxcms.eof
Response.Write "<tr><td height='22' align='left' class=table-xia><font color=#FF0000>·</font><a href='showweb.asp?art_id="&RsHxcms("art_id")&"' title='"&RsHxcms("art_title")&"' "& nnn &">"&gotTopic(RsHxcms("art_title"),nn)&"</a></td></tr>" & vbCrLf
RsHxcms.movenext
loop
if RsHxcms.bof and RsHxcms.eof then
Response.Write "<tr><td align='center' valign='middle'>当前没有文章!</td></tr>" & vbCrLf
end if
RsHxcms.close
set RsHxcms=nothing
Response.Write "</TABLE>" & vbCrLf
end sub
'=================================================
'过程名:best_art
'作 用:推荐文章
'参 数:n-调用条数,nn-显示长度
' NewWindows-----是否新窗打开,True为是,False为否
'Web: www.ynsky.com.cn
'=================================================
sub best_art(n,nn,NewWindows)
dim nnn
if NewWindows=True then
nnn="target='_blank'"
else
nnn=""
end if
Response.Write "<TABLE width='100%' cellSpacing=0 cellPadding=0 border=0 align='center'>" & vbCrLf
set RsHxcms=server.createobject("adodb.recordset")
set RsHxcms=conn.execute("select top "&n&" * from web where passed=0 and isbest=1 order by art_id desc")
do while not RsHxcms.eof
Response.Write "<tr><td height='22' align='left' class=table-xia> <font color=#FF0000>·</font><a href=showweb.asp?art_id="&RsHxcms("art_id")&" title="&RsHxcms("art_title")&" "& nnn &">"&gotTopic(RsHxcms("art_title"),nn)&"</a></td></tr>" & vbCrLf
RsHxcms.movenext
loop
if RsHxcms.bof and RsHxcms.eof then
Response.Write "<tr><td align='center' valign='middle'>没有推荐文章!</td></tr>" & vbCrLf
end if
RsHxcms.close
set RsHxcms=nothing
Response.Write "</TABLE>" & vbCrLf
end sub
'=================================================
'过程名:top_art
'作 用:热门文章
'参 数:n-调用条数,nn-显示长度,popwebnum-热门点击数
' NewWindows-----是否新窗打开,True为是,False为否
'Web: www.ynsky.com.cn
'=================================================
sub top_art(n,nn,NewWindows)
dim nnn
if NewWindows=True then
nnn="target='_blank'"
else
nnn=""
end if
Response.Write "<TABLE width='100%' cellSpacing=0 cellPadding=0 border=0 align='center'>" & vbCrLf
set RsHxcms=server.createobject("adodb.recordset")
set RsHxcms=conn.execute("select top "&n&" * from web where passed=0 and art_count>="&popwebnum&" order by art_id desc")
do while not RsHxcms.eof
Response.Write "<tr><td height='22' align='left' class=table-xia> <font color=#FF0000>·</font><a href=showweb.asp?art_id="&RsHxcms("art_id")&" title="&RsHxcms("art_title")&" "& nnn &">"&gotTopic(RsHxcms("art_title"),nn)&"</a></td></tr>" & vbCrLf
RsHxcms.movenext
loop
if RsHxcms.bof and RsHxcms.eof then
Response.Write "<tr><td align='center' valign='middle'>没有热门文章!</td></tr>" & vbCrLf
end if
RsHxcms.close
set RsHxcms=nothing
Response.Write "</TABLE>" & vbCrLf
end sub
'=================================================
'过程名:img_art
'作 用:图片文章
'参 数:n-调用条数,nn-显示标题长度
' ImgWidth ----图片宽度
' ImgHeight ----图片高度
' NewWindows-----是否新窗打开,True为是,False为否
'Web: www.ynsky.com.cn
'=================================================
sub img_art(n,nn,ImgWidth,ImgHeight,NewWindows)
dim nnn,imagess
if NewWindows=True then
nnn="target='_blank'"
else
nnn=""
end if
Response.Write "<TABLE width='100%' cellSpacing=5 cellPadding=0 border=0 align='center'>" & vbCrLf
Response.Write "<TR>" & vbCrLf
set rshx66=conn.execute("SELECT top "&n&" * FROM web where isimg=1 and passed=0 order by art_id desc")
if rshx66.EOF then
Response.Write ("<TD align=center>暂无图片文章</TD>")
else
do while not rshx66.eof
if rshx66("images")<>"" then
imagess=rshx66("images")
else
imagess="img/nopic.gif"
end if
Response.Write "<TD align=center>"
Response.Write "<table width=50 border=0 cellpadding=3 cellspacing=1 bgcolor=#d7d7d7><tr><td bgcolor=#ffffff><a href='Showweb.asp?art_id="&rshx66("art_id")&"' title='最新图片文章:"&rshx66("art_title")&"' "& nnn &"><img src='"&imagess&"' width='"& ImgWidth &"' height='"& ImgHeight &"' border=0 alt='最新图片文章:"&rshx66("art_title")&"'></a></td></tr></table>"
Response.Write "<center><font color='#009933'>"&gotTopic(rshx66("art_title"),nn)&"</font></center>"
Response.Write "</TD>"
rshx66.movenext
loop
end if
rshx66.close
set rshx66=nothing
Response.Write "</TR></TABLE>" & vbCrLf
end sub
'=================================================
'过程名:count_art
'作 用:文章统计
'参 数:无
'Web: www.ynsky.com.cn
'=================================================
sub count_art()
dim zw,zc,jw,zzw,sw,yd,pl
zw=conn.execute("select count(*) from web where passed=0")(0)
sw=conn.execute("select count(*) from web where passed=1")(0)
jw=conn.execute("select count(*) from web where passed=0 and art_date>=#"&date()&"#")(0)
zzw=conn.execute("select count(*) from web where passed=0 and art_date>=#"&date()-1&"#")(0)
yd=conn.execute("select sum(art_count) from web")(0)
pl=conn.execute("select sum(reviewcount) from web")(0)
Response.Write "<TABLE width='100%' cellSpacing=0 cellPadding=0 border=0 align='center'>" & vbCrLf
Response.Write "<tr><td height=20> <font color=#FF0000>·</font><strong>文章总数:</strong>"&zw&" 条</td></tr>" & vbCrLf
Response.Write "<tr><td height=20> <font color=#FF0000>·</font><strong>待审文章:</strong>"&sw&" 条</td></tr>" & vbCrLf
Response.Write "<tr><td height=20> <font color=#FF0000>·</font><strong>今日文章:</strong><font color='red'>"&jw&"</font> 条</td></tr>" & vbCrLf
Response.Write "<tr><td height=20> <font color=#FF0000>·</font><strong>评论总数:</strong>"&pl&" 条</td></tr>" & vbCrLf
Response.Write "<tr><td height=20> <font color=#FF0000>·</font><strong>文章阅读:</strong>"&yd&" 人次</td></tr>" & vbCrLf
Response.Write "</TABLE>" & vbCrLf
end sub
'=================================================
'过程名:class_art
'作 用:文章分类
'参 数:无
'Web: www.ynsky.com.cn
'=================================================
sub class_art()
sql="select * from web_cat where sid=0"
set rs1=conn.execute(sql)
do while not rs1.eof
if request("cat_id")=cstr(rs1("cat_id")) then
response.write " <font color=""#FF0000"">·"&rs1("cat_name")&"</font><BR>"
else
response.write " <font color=""#FF0000"">·</font><a href='web.asp?cat_id="&rs1("cat_id")&"'>["&rs1("cat_name")&"]</a><BR>"
end if
sql="select * from web_cat where sid="&rs1("cat_id")
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=""#FF0000"">├> "&rs2("cat_name")&"</a></font><BR>"
else
response.write " <a href='web_list.asp?cat_id="&rs2("cat_id")&"'>├ "&rs2("cat_name")&"</a><BR>"
end if
rs2.movenext
loop
rs1.movenext
loop
rs2.close
set rs2=nothing
rs1.close
set rs1=nothing
end sub
'=================================================
'过程名:main_Art
'作 用:显示文章位置导航
'参 数:无
'Web: www.ynsky.com.cn
'=================================================
sub main_Art()
if cat_id>0 then
Response.Write " 您的位置: <a href='index.asp'>"&webname&"</a> >> <a href='web.asp'>旅游手记中心</a>" & vbCrLf
sql="select cat_id,cat_name,sid from web_cat where cat_id="&cat_id
set rs3=conn.execute(sql)
if rs3.eof then
Response.Redirect "show_error.asp?eid=参数错误,找不到相关的记录!"
Response.End
End IF
if rs3("sid")<>"0" then
sql="select cat_id,cat_name from web_cat where cat_id="&rs3("sid")
set rs4=conn.execute(sql)
Response.Write " >> <a href=""web.asp?cat_id="&rs4("cat_id")&""">"&rs4("cat_name")&"</a>" & vbCrLf
rs4.close
set rs4=nothing
end if
Response.Write " >> <a href=""web_list.asp?cat_id="&rs3("cat_id")&""">"&rs3("cat_name")&"</a>" & vbCrLf
rs3.close
set rs3=nothing
else
Response.Write " 您的位置: <a href='index.asp'>"&webname&"</a> >> <a href='web.asp'>旅游手记中心</a>" & vbCrLf
end if
end sub
'=================================================
'过程名:search_Art
'作 用:显示文章搜索表单
'参 数:无
'Web: www.ynsky.com.cn
'=================================================
sub search_Art()
Response.Write "<form name='form2' method='post' action='web_list.asp'><div align=center><input type='radio' name='select' value='art_title' checked class='inuptCG'>标题 <input type='radio' name='select' value='art_content' class='inuptCG'>内容 <input type='radio' name='select' value='review' class='inuptCG'>评论<br><input type='text' name='keyword' size='15' value='搜索关键字' maxlength='50' onfocus=""this.value=''"" class='input'> <input type='submit' name='search' value='搜索' onmouseover=""this.className='boton'"" onmouseout=""this.className='botoff'""></div></form>" & vbCrLf
end sub
'=================================================
'过程名:list_Art
'作 用:简洁文章列表
'参 数:n-调用条数,nn-显示长度,popwebnum-热门点击数
' NewWindows-----是否新窗打开,True为是,False为否
'Web: www.ynsky.com.cn
'=================================================
sub list_Art(n,nn,NewWindows)
dim nnn
if NewWindows=True then
nnn="target='_blank'"
else
nnn=""
end if
dim id1,zc,folder,rsy,rsy1
Response.Write "<table width='100%' border='0' cellspacing='0' cellpadding='0'>"
set rsy=conn.execute("select cat_id,cat_name from web_cat where sid="&cat_id&" order by cat_id")
while not rsy.eof
id1=rsy("cat_id")
zc=conn.execute("select count(*) from web where passed=0 and (cat_id="&id1&" or cat_id in(select cat_id from web_cat where sid="&id1&"))")(0)
Response.Write "<tr>"
for i=1 to 1
if rsy.eof then
Response.Write "<td width='100%'></td>" & vbCrLf
else
Response.Write "<td width='99%' valign='top' align='right'>" & vbCrLf
Response.Write "<table width='100%' border='0' cellspacing='0' cellpadding='0'>" & vbCrLf
Response.Write "<tr><td height='26' class='a4'> <b>"&rsy("cat_name")&"</b> (文章:"&zc&" 条)</td></tr>" & vbCrLf
Response.Write "</table>" & vbCrLf
Response.Write "<table width='100%' border='1' align='center' cellspacing='0' cellpadding='0' bgcolor='#FFFFFF' bordercolor='#f0f0f0' style='border-collapse: collapse'>" & vbCrLf
set rsy1=conn.execute("select top "&n&" * from web where passed=0 and (cat_id="&id1&" or cat_id in(select cat_id from web_cat where sid="&id1&")) order by art_id desc")
if rsy1.eof then
Response.Write "<tr><td align='center'>此分类暂无文章</td></tr>" & vbCrLf
else
do while not rsy1.eof
if rsy1("istop")="1" then
folder="<img src=""img/1.gif"" title=固顶文章>" & vbCrLf
elseif rsy1("isbest")="1" then
folder="<img src=""img/2.gif"" title=推荐文章>" & vbCrLf
elseif rsy1("art_count")>=popwebnum then
folder="<img src=""img/3.gif"" title=热门文章>" & vbCrLf
else
folder="<img src=""img/4.gif"" title=普通文章>" & vbCrLf
end if
Response.Write "<tr>" & vbCrLf
Response.Write "<TD width='6%' align=Center height='26'>"&folder&"</TD>" & vbCrLf
Response.Write "<td> <a href=showweb.asp?art_id="&rsy1("art_id")&" title="&rsy1("art_title")&" "& nnn &">"&gotTopic(rsy1("art_title"),nn)&"</a>"
if rsy1("isimg")=1 then
Response.Write " <img src='img/img.gif' alt='旅游手记(图片)' align=absmiddle border=0>" & vbCrLf
end if
if DateDiff("h",rsy1("art_date"),now())<=24 then
Response.Write "<img src='img/new.gif' alt='24小时内文章'>" & vbCrLf
end if
Response.Write "</td>" & vbCrLf
Response.Write "<TD align=middle width='10%'>"&rsy1("art_count")&"</td>" & vbCrLf
Response.Write "<TD align=Center width='15%'>"&year(rsy1("art_date"))&"-"&Right("0"&month(rsy1("art_date")),2)&"-"&Right("0"&day(rsy1("art_date")),2)&"</td>" & vbCrLf
Response.Write "</tr>" & vbCrLf
rsy1.movenext
loop
rsy1.close
set rsy1=nothing
end if
Response.Write "<tr><td align='right' colspan=4><a href='web_list.asp?cat_id="&id1&"'>more</a> </td></tr>" & vbCrLf
Response.Write "</table></td>" & vbCrLf
rsy.movenext
end if
next
Response.Write "</tr>" & vbCrLf
wend
Response.Write "</table>" & vbCrLf
rsy.close
set rsy=nothing
end sub
'=================================================
'过程名:displayList_Art
'作 用:带分页功能的文章列表
'参 数:popwebnum-------热门点击数
' nn--------------标题长度
' Hxperpage-------每页显示条数
' classyes--------是否显示分类,True为是,False为否
' NewWindows------是否新窗打开,True为是,False为否
'Web: www.ynsky.com.cn
'=================================================
sub displayList_Art(nn,Hxperpage,classyes,NewWindows)
Dim CurPage,Url_Add
Url_Add="?"
If Request.QueryString("Page")<>"" Then
Curpage=Request.QueryString("Page")
If IsInteger(Curpage)=False Then Curpage=1
Else
Curpage=1
End If
if request("keyword")<>"" then
if instr(request("keyword"),"'")>0 then
Response.Write "<script language=javascript>alert('搜索参数非法');javascript:history.back();</script>"
Response.End
end if
end if
dim mtyid,hx01,hx66010
mtyid=int(cat_id)
set hx01=conn.execute("select cat_id,cat_name,sid from web_cat order by cat_id")
do while not hx01.eof
if mtyid=hx01("sid") then
hx66010=hx66010+" or cat_id="&hx01("cat_id") '显示页所需变量web_list.asp
end if
hx01.movenext
loop
hx01.close
set hx01=nothing
if cat_id>0 then
sql="select * from web where passed=0 and (cat_id="&cat_id&hx66010&") order by istop desc,art_id DESC"
Url_Add=Url_Add&"cat_id="&cat_id&"&"
elseif request("keyword")<>"" and (request("select")="art_title" or request("select")="art_content" or request("select")="review" or request("select")="tjuser") then
sql="select * from web where passed=0 and "&request("select")&" like '%"&Jencode(checkspace(request("keyword")))&"%' order by istop desc,art_date DESC"
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -