<% Response.Buffer = True 

For each j in Request.QueryString 
	sss= sss& j & Request.QueryString(j) 
Next
For each j in Request.form 
	sss= sss& j & Request.QueryString(j) 
Next
sss=sss&LCase(request.servervariables("QUERY_STRING"))
GuoLv="select,insert,;,update,',delete,exec,admin,count,drop,from,truncate,netlocalgroup,and,chr,master,declare,*,char,script,%"
GuoLvA=split(GuoLv,",")
for i=0 to ubound(GuoLvA)
  if instr(sss,GuoLvA(i))<>0 then
    Response.Redirect "res://shdoclc.dll/dnserror.htm"
    response.end		
  end if
next

%>
<!--#include file = admin_conn.asp -->

<!--#include file = titleb.asp -->

<%

newsid=chkhtm(trim(Request("newsid")))
page=chkhtm(trim(request("page")))
if newsid="" then newsid=chkhtm(trim(Request("id")))
id=newsid
if newsid="" then 
  Response.Write "<BR><BR><BR><center>参数不正确</center>"
  response.end  
end if



if (not isNumeric(newsid)) then
  Response.Write "<Script Language=JavaScript>alert('ＩＤ参数错误或有非法字符或没指定参数，请勿随意提交数据！');location.href='/';</Script>"
  response.end  
end if

if (not isNumeric(page)) then
	page=""
end if

XuasGG=config("xuasGG")

sql = "select * from news where sh=1 and id="&newsid
Set rs = Server.CreateObject("ADODB.RecordSet")
rs.Open sql,conn,1,1
if rs.recordcount=0 then
  Response.Write "<BR><BR><Center>该新闻无法显示，可能已删除或未审核！<BR><BR>"
  rs.close:set rs=nothing
  conn.close:set conn=nothing
  Response.end
end if



title=rs("title")
title="<font color="&rs("titlecolor")&">"&trim(title)&"</font>"
webtitle=rs("title")
htitle=trim(rs("htitle"))&" "
dat=rs("time")
zz=trim(rs("zz"))&" "
laiyuan=rs("laiyuan")&" "
piczz=rs("piczz")&" "
yurl=rs("yurl")
pic=rs("pic")
filename=rs("filename")
if filename<>"0" and config("DongTaiZhuanXiang")="1" then
	rs.close:set rs=nothing
	conn.close
	set conn=nothing
	Response.Redirect filename
	Response.end
end if

hit=rs("hit")+1
hit=hit
webxgnews=trim(chkhtm(rs("xgnews")))
if webxgnews="" then webxgnews=left(rs("title"),3)
if webxgnews<>"" then
	webxgnews=replace(webxgnews,"[","")
	webxgnews=replace(webxgnews,"]","")
end if
SQL="select top 10 [id],[title],[xgnews] from [news] where ( [title] like '%"&webxgnews&"%' or [xgnews] like '%"&webxgnews&"%' ) and [id]<>"&chkhtm(trim(Request("newsid")))&" order by [id] desc"
Set xgrs = Server.CreateObject("ADODB.RecordSet")
xgrs.Open SQL,conn,1,1
while not xgrs.eof
   xgnews=xgnews + "·<a href=news_view.asp?newsid="&xgrs("id")&" title='"&xgrs("title")&"'>"&xgrs("title")&"</a><BR>"
xgrs.movenext
wend
if xgrs.recordcount=0 then xgnews="没有相关信息"
xgrs.close
set xgrs=nothing

content=rs("content")&" "
content=replace(content,"]","］")
content=replace(content,"[","［")

NewsWordKey=","&config("NewsWordKey")&","
aabb=split(NewsWordKey,",")
for jjj=0 to ubound(aabb)
	content=replace(content,aabb(jjj),"<a target=_blank title='查看更多' href=so/?word="&aabb(jjj)&"><u>"&aabb(jjj)&"</u></a>")
next
	
if yurl<>"" then
	content=content&" <BR><div align=right><a href="&yurl&" target=_blank>原贴地址</a></div>"
end if


if instr(content,"$$分页$$")<>0 then
	if page="" then page=1
	nrfy=split(content,"$$分页$$")
	page=page-1
	if page>ubound(nrfy) then page=0
	if page<0 then page=0
	content=nrfy(page)
	fy=1
	
	content=content&"<center>第&nbsp;"
	for i=0 to ubound(nrfy)
		sss=""
		if clng(page)=clng(i) then
			sss="font-weight:700;background-color: #EEEEEE;"
		end if
		content=content&"<a href='?NewsID="&trim(NewsID)&"&page="&i+1&"' style='"&sss&"'>&nbsp;"&i+1&"&nbsp;</a>"
	next
	content=content&"页</center>"
end if


'  if config("ggso")="1" then
'  	content=content&GoogleSo()
'  end if
  
'  if XuasGG="1" then
'	nrGG="<center><iframe name='xGGI1' src='http://www.xuas.com/Other/GoogleAD/Google468x60-FFFFFF.asp' marginwidth='1' marginheight='1' height='60' width='468' scrolling='no' border='0' frameborder='0'></iframe></center><BR><BR>"
' 	if config("xuasGGWZ")="1" then
'		content=nrgg+content
'	elseif config("xuasGGWZ")="2" then
'		content=content+nrgg
' 	end if
'  end if
  
  
if pl()=1 then ppll="<BR><hR size=1><script language='javascript' src='js_news_pl.asp?id="&id&"'></script>"
url=trim(rs("url"))

conn.Execute = "update news set hit=hit+1 where ID="&newsid

if url<>"" then 
  Response.Redirect url
end if

set rspl = Server.CreateObject("ADODB.RecordSet")
rspl.Open "select * from [NewsPL] where NewsID="&newsid&" and sh=1 order by id desc",conn,1,1
pls=rspl.recordcount
rspl.close
set rspl=nothing

GetUrl ="http://"&Request.ServerVariables("SERVER_NAME") & Request.ServerVariables("URL") &"?" &request.ServerVariables("QUERY_STRING")
content2=content

pp="<div align='center'><table border='0' cellpadding='3' cellspacing='0'><tr>"
pp=pp&"<td><input type='button' value='查看/发表评论("&pls&")' onclick=""window.open('NewsPL.asp?id="&ID&"')"" ></td>"
pp=pp&"<td align=center><input type='button' value='打印本页' onclick=""javascript:window.print()""></td>"
pp=pp&"<td align=center>"&GoogleHSo()&"</td>"
if config("WeiBoShare")="1" then pp=pp& "<td align=center><input type='button' value='分享到微博' onclick=""window.open('http://service.weibo.com/share/share.php?url="&GetUrl&"&appkey=2306410365&title=《"&glhtml(title)&"》。"&titleb(glhtml(content2),190) &Server.UrlEncode("#讯时内容分享#")&"&pic="&pic&"&ralateUid=')"" ></td>"

pp=pp&"</tr></table></div>"

response.flush


    lmid=rs("lm3")
     if lmid="0" or lmid="" then lmid=rs("lm2")
        if lmid="0" or lmid="" then lmid=rs("lm")
        
	sql2 = "select * from [lm] where  [id]="&clng(lmid)
	Set rs2 = Server.CreateObject("ADODB.RecordSet"):rs2.cursorlocation=3
	rs2.Open sql2,conn,1,1
	Response.flush
	if rs2.recordcount<>0 then
	
		lm=rs2("lm")&rs2("lm2")&rs2("lm3")
		if lm="" then lm=" "
		if title="" then title=" "
		
		mbid=rs2("mb")
		
	else
	  Response.Write "<center><BR><BR><BR>此文章栏目不正确。请为此文章指定栏目。"
	  rs2.close:set rs2=nothing
	  conn.close:set conn=nothing
	  Response.end
	  mbid=1
	end if
	rs2.close
	set rs2=nothing
	

if (not isNumeric(mbid)) then
	Response.Write "此栏目("&lm&")模版不正确，请为此栏目指定模版。"&mbid
	Response.flush 
	conn.close:set conn=nothing
	Response.end
end if

if laiyuan="" then laiyuan="&nbsp;"
if piczz="" then piczz=" "
if zz="" then zz=" "

		sql3 = "select * from [newsmb] where [id]="&mbid
		Set rs3 = Server.CreateObject("ADODB.RecordSet"):rs3.cursorlocation=3
		rs3.Open sql3,conn,1,1
		if htitle="" then htitle="&nbsp;"
		if rs3.recordcount<>0 then
		  updown=rs3("updown")
		  nr=rs3("mid")
		  application(configpath&"mbupdown"&mbID)=updown
		  application(configpath&"mb"&mbid)=nr
		  'Response.Write "开始缓存此模版"&MBID&"。"
		else
		  response.write "<center><BR><BR><BR>模版设置不正确。"
		  conn.close:set conn=nothing
		  Response.end
		end if 
		rs3.close
		set rs3=nothing
	
	if instr(nr,"xuas00")<>0 then 
		content=content&GoogleSo()
		'nrGG="<center><iframe name='xGGI1' src='http://www.xuas.com/Other/GoogleAD/Google468x60-FFFFFF.asp' marginwidth='1' marginheight='1' height='60' width='468' scrolling='no' border='0' frameborder='0'></iframe></center><BR><BR>"
		'content=content+nrgg
		
	else
		if config("ggso")="1" then
			content=content&GoogleSo()
		end if
		
		if XuasGG="1" then
			nrGG="<center><iframe name='xGGI1' src='http://www.xuas.com/Other/GoogleAD/Google468x60-FFFFFF.asp' marginwidth='1' marginheight='1' height='60' width='468' scrolling='no' border='0' frameborder='0'></iframe></center><BR><BR>"
			if config("xuasGGWZ")="1" then
				content=nrgg+content
			elseif config("xuasGGWZ")="2" then
				content=content+nrgg
			end if
		end if	
	
	end if
	
  updown=application(configpath&"mbupdown"&mbID)
  nr=application(configpath&"mb"&mbid)
  nr=replace(nr,"$$路径$$",lmpath())
  nr=replace(nr,"$$副标题$$",htitle)
  nr=replace(nr,"$$标题$$",title)
  nr=replace(nr,"$$栏目名$$",lm)
  nr=replace(nr,"$$时间$$",dat)
  nr=replace(nr,"$$访问量$$",hit)
  nr=replace(nr,"$$内容$$",content)
  nr=replace(nr,"$$来源$$",laiyuan)
  nr=replace(nr,"$$作者$$",zz)
  nr=replace(nr,"$$图片作者$$",piczz)
  nr=replace(nr,"$$评论$$",ppll)
  nr=replace(nr,"$$打印$$",pp)
  nr=replace(nr,"$$工具栏$$",pp)
  nr=replace(nr,"$$相关$$",xgnews)
  nr=replace(nr,"$$NEWSID$$",newsid)
  nr=replace(nr,"$$XUASPATH$$",config("path"))
  nr=google(nr)
  

  if updown=0 then
    nr=replace(nr,"$$上下条$$","")
  else
    Set rs4 = Server.CreateObject("ADODB.RecordSet")
    rs4.Open "select top 1 * from [news] where (lm2='"&lmid&"' or lm='"&lmid&"' or lm3='"&lmid&"') and id<"&newsid&" and sh=1 order by [time] desc , id desc",conn,1,1
    if rs4.recordcount<>0 then
	    uuu="上一条：<a href="&hrefID(rs4("id"),rs4("filename"))&"><font color="&rs4("titlecolor")&">"&rs4("title")&"</font></a><BR>"
	else
	    uuu="上一条：已经没有了<BR>"
	end if
    Set rs5 = Server.CreateObject("ADODB.RecordSet")
    rs5.Open "select top 1 * from [news] where (lm2='"&lmid&"' or lm='"&lmid&"' or lm3='"&lmid&"') and id>"&newsid&" and sh=1 order by [time] asc , id asc",conn,1,1
    if rs5.recordcount<>0 then
	    uuu=uuu&"下一条：<a href="&hrefID(rs5("id"),rs5("filename"))&"><font color="&rs5("titlecolor")&">"&rs5("title")&"</font></a>"
	else
	    uuu=uuu&"下一条：已经没有了"
	end if
    nr=replace(nr,"$$上下条$$",uuu)
    rs4.close
    set rs4=nothing
    rs5.close
    set rs5=nothing
  end if
  response.write nr
response.flush


conn.close
set conn=nothing
%>

