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

📄 syscode_news.asp

📁 后台登陆admin.asp
💻 ASP
📖 第 1 页 / 共 2 页
字号:
<%

'****************************************************
dim news_id,cat_id,news_title,news_images,news_imgyes
dim founderr,errmsg
news_id=trim(request.querystring("news_id"))
if news_id<>"" then
    if not isInteger(news_id) then
    FoundErr=True
    ErrMsg=ErrMsg & "<br><li>非法的新闻ID参数!</li>"
    end if
	news_id=CLng(news_id)
else
	news_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 news_id>0 then
   sql="select * from news where news_id="&news_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("news_title")&""
                        cat_id=CLng(rs("cat_id"))
                        news_title=rs("news_title")
                        news_images=rs("images")
                        news_imgyes=rs("imgyes")
                        rs("news_count")=rs("news_count")+1
			rs.update
		end if
	end if
end if

if FoundErr=True then
	Call HxErrMsg()
	response.end
end if
'=================================================
'过程名:top_news
'作  用:热门新闻排行
'参  数:n--------------调用条数
'        nn-------------显示长度
'        NewWindows-----是否新窗打开,True为是,False为否
'Web:    www.ynsky.com.cn
'=================================================
sub top_news(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 news where passed=0 and news_count>="&popnewsnum&" order by news_id desc")
do while not RsHxcms.eof
Response.Write "<tr><td height='22' align='left' class=table-xia>&nbsp;<font color=#FF0000>·</font><a href=shownews.asp?news_id="&RsHxcms("news_id")&" title="&RsHxcms("news_title")&" "& nnn &">"&gotTopic(RsHxcms("news_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_news
'作  用:图片新闻
'参  数:n--------------调用条数
'        nn-------------显示文字长度
'        ImgWidth   ----图片宽度
'        ImgHeight  ----图片高度
'        NewWindows-----是否新窗打开,True为是,False为否
'Web:    www.ynsky.com.cn
'=================================================
sub img_news(n,nn,NewWindows,ImgWidth,ImgHeight)
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 news where isimg=1 and images<>'' and passed=0 order by news_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='Shownews.asp?news_id="&rshx66("news_id")&"' title='最新图片新闻:"&rshx66("news_title")&"' "& nnn &"><img src='"&imagess&"' width='"& ImgWidth &"' height='"& ImgHeight &"' border=0 alt='最新图片新闻:"&rshx66("news_title")&"'></a></td></tr></table>"
Response.Write "<center><font color='#009933'>"&gotTopic(rshx66("news_title"),nn)&"</font></center>"
Response.Write "</TD>"
rshx66.movenext
loop
end if
rshx66.close
set rshx66=nothing
Response.Write "</TR></TABLE>" & vbCrLf
end sub

'=================================================
'过程名:class_news
'作  用:新闻分类
'参  数:无
'Web:    www.ynsky.com.cn
'=================================================
sub class_news()
sql="select * from newcat where sid=0"
set rs1=conn.execute(sql)
do while not rs1.eof
if request("cat_id")=cstr(rs1("cat_id")) then
response.write "&nbsp;<font color=""#FF0000"">·"&rs1("cat_name")&"</font><BR>"
else
response.write "&nbsp;<font color=""#FF0000"">·</font><a href='news.asp?cat_id="&rs1("cat_id")&"'>"&rs1("cat_name")&"</a><BR>"
end if
sql="select * from newcat 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 "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<font color=""#FF0000"">├ "&rs2("cat_name")&"</a></font><BR>"
else
response.write "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href='news.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_news
'作  用:显示新闻位置导航
'参  数:无
'Web:    www.ynsky.com.cn
'=================================================
sub main_news()
if cat_id>0 then
  Response.Write "&nbsp;&nbsp;您的位置: <a href='index.asp'>"&webname&"</a> >> <a href='news.asp'>走进云南</a>" & vbCrLf
  sql="select cat_id,cat_name,sid from newcat 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 newcat where cat_id="&rs3("sid")
     set rs4=conn.execute(sql)
     Response.Write " >> <a href=""news.asp?cat_id="&rs4("cat_id")&""">"&rs4("cat_name")&"</a>" 
     rs4.close
     set rs4=nothing
  end if
  Response.Write " >> <a href=""news.asp?cat_id="&rs3("cat_id")&""">"&rs3("cat_name")&"</a>" 
  rs3.close
  set rs3=nothing 
else
  Response.Write "&nbsp;&nbsp;您的位置: <a href='index.asp'>"&webname&"</a> >> <a href='news.asp'>走进云南</a>" & vbCrLf
end if
end sub

'=================================================
'过程名:search_news
'作  用:显示新闻搜索表单
'参  数:无
'Web:    www.ynsky.com.cn
'=================================================
sub search_news()
Response.Write "<form name='form2' method='post' action='news.asp'><div align=center><input type='radio' name='select' value='news_title' checked class='inuptCG'>标题&nbsp;<input type='radio' name='select' value='news_content' class='inuptCG'>内容&nbsp;<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'>&nbsp;<input type='submit' name='search'  value='搜索' onmouseover=""this.className='boton'"" onmouseout=""this.className='botoff'""></div></form>" & vbCrLf
end sub

'=================================================
'过程名:displayList_news
'作  用:带分页功能的新闻列表
'参  数:nn--------------标题长度
'        Hxperpage-----每页显示条数
'        classyes--------是否显示分类,True为是,False为否
'        NewWindows------是否新窗打开,True为是,False为否
'Web:    www.ynsky.com.cn
'=================================================
sub displayList_news(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 newcat order by cat_id")
do while not hx01.eof
if mtyid=hx01("sid") then
hx66010=hx66010+" or cat_id="&hx01("cat_id") '显示页所需变量news.asp
end if
hx01.movenext
loop

⌨️ 快捷键说明

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