<!-- #include file="Inc/Inc.asp" -->
<!-- #include file="Inc/Function.asp" -->
<%call head()

'lonline为会员离线时间
if dateSQL="0" then
conn.Execute("delete from online where times <= '"&DateAdd("n", lonline, Now())&"'")

conn.Execute("delete from sqdt where shijian <= '"&DateAdd("n", "-300", Now())&"'")
else
conn.Execute("delete from online where DATEDIFF('s', times, now()) > 60*60")
conn.Execute("delete from sqdt where DATEDIFF('s', shijian, now()) > 60*300")
end If

dim ids,p
p=trim(request.QueryString("p"))
id=request.QueryString("id")

Set rs=Server.CreateObject("ADODB.Recordset")
sql="Select * from sms where ID="&id
rs.open sql,conn,1,1
'conn.Execute("Select Hit from sms where ID="&id&"")
if IsNumeric(rs("hit"))=False then
  rs.close
  set rs=Nothing
conn.Execute("update sms set Hit=0 where ID="&id)
conn.Execute("update sms set Hit=Hit+1 where ID="&id)
else
conn.Execute("update sms set Hit=Hit+1 where ID="&id)
end if


if id="" or IsNumeric(id)=False then
  Call Error("<card title=""ID无效""><p>ID无效1！")
  end if

ids=trim(request.QueryString("class"))
if p="" or IsNumeric(p)=False then p=1

if ids="" or IsNumeric(ids)=False Then
ids=trim(request.QueryString("classid"))
End If
if ids="" or IsNumeric(ids)=False Then
  Call Error("<card title=""ID无效""><p>ID无效2！")
  end if

Set rs = Server.CreateObject("ADODB.Recordset")
sql="Select * from WZclass where classid="&ids
rs.open sql,conn,1,1 
if rs.eof then
  rs.close
  set rs=Nothing
  Call Error("<card title=""ID无效""><p>ID无效3！")
  end if
paycent=rs("cent")
payID=rs("payID")
classname=rs("class")
  rs.close
  set rs=Nothing

Set rs = Server.CreateObject("ADODB.Recordset")
sql="Select * from sms where ID="&id
rs.open sql,conn,1,3
if rs.eof then
  rs.close
  set rs=Nothing
  Call Error("<card title=""ID无效""><p>ID无效4！")
  end if
titlewen=rs("title")
Call saycarda(""&ubb1(rs("title"))&"")
if myid=0 then

else

'检查有几条新留言
dim newguest
newguest = 0
IF myid > 0 THEN
  newguest = ForNewGuest(myid)
END IF
if newguest > 0 then
Response.write "<a href='bbs/msgview.asp?url="&Replace(Replace(R_url(),"sid=","sidoo="),"sid=","sidoo=")&"&amp;sid="&sid&"'>您有"&newguest&"条新消息</a><br/>"& chr(13)
end if
end If
If saytk=100 Then Response.write "<div class=""path"">"
%>
<a href='index.asp?sid=<%=sid%>&amp;saytk=<%=saytk%>'>首页</a>>
<a href='list.asp?class=<%=ids%>&amp;sid=<%=sid%>&amp;saytk=<%=saytk%>'><%=classname%></a>>正文
<%
If saytk=100 Then 
Response.write "</div><div class=""ad""></div>"
else
Response.write "<br/>"
End if
if paycent<>0 then
if Instr(","&payID&",",","&myid&",") > 0 or keys=1 then
else
response.write "查看此文章需用"&paycent&getcent&",确定要查看吗？"
response.write "<br/><a href='paysms.asp?class="&ids&"&amp;id="&id&"&amp;sid="&sid&"'>是的</a>"
Response.write "<br/><anchor>取消<prev/></anchor>"
Call headsay()
response.end
end if
end if


If Not rs.eof Then
Dim gopage,PS,conlen,page,pagecount,ys,startc

end If

dim Counts
Counts=rs("smspin")
If saytk=100 Then Response.Write "<dl class=""contit""><dt>"


Response.Write	"<b>"&ubb(rs("title"))&"</b>"


%>(<%=ubb1(rs("hit"))%>)<br/><%
If saytk=100 Then Response.Write "</dt><dd>"
response.write "字数:"
response.write len(rs("test"))
Response.Write	"<br/>时间:"&ubb(rs("yd_date"))&"<br/>"

If saytk=100 Then Response.Write "</dd></dl><div class=""content"">"

if rs("pic")<>"" then
Response.Write	"<img src='"&rs("pic")&"' alt='load...'/><br/>"
end if
Content=rs("test")
dim nums
nums=trim(request.querystring("nums"))
if nums<>"" and nums<>"0" and Isnumeric(nums)<>False then
viewtnums=abs(nums)
end if
if request.querystring("w")<>1 then
dim pageWordNum,StartWord,Content,Length,PageAll,i,ii
pageWordNum=viewtnums
StartWord = 1
Length=len(Content)
PageAll=(Length+PageWordNum-1)\PageWordNum
ii=clng(request("ii"))
i=clng(request("i"))
if ii<>0 then i=ii-1
if isnull(i) or i="" then i=0

	dim ccc,sss
	ccc=instr(content,"||")
	if ccc>0 then
	sss=split(content,"||")
	PageAll=ubound(sss)+1
		if i>PageAll-1 then i=PageAll-1
	content = sss(i)

	else
		if clng(i)>int(PageAll) then i=PageAll-1
	Content = mid(Content,StartWord+i*PageWordNum,PageWordNum)
	end if
response.write("<br/>" &ubb1(content)& "<br/>")
If saytk=100 Then Response.Write "</div><dl class=""conmore""><dt>"
if 0<=i<PageAll then
       Response.Write "<br/>"
end If

   if cint(i)<cint(PageAll)-1 then
       Response.Write "<a href='article.asp?class="&ids&"&amp;id=" &  rs("id") & "&amp;i=" & i+1 & "&amp;p=" & p & "&amp;nums=" & nums & "&amp;sid="&sid&"&amp;saytk="&saytk&"'>下页</a>"
   End If
   
   if cint(i)>0 then 
   Response.Write " <a href='article.asp?class="&ids&"&amp;id=" &  rs("id") & "&amp;i=" & i-1 & "&amp;p=" & p & "&amp;nums=" & nums & "&amp;sid="&sid&"&amp;saytk="&saytk&"'>上页</a>"
		if  i<pageall-1 then Response.Write "&nbsp;<a href='article.asp?class="&ids&"&amp;id=" &  rs("id") & "&amp;i=100&amp;p=" & p & "&amp;nums=" & nums & "&amp;sid="&sid&"&amp;saytk="&saytk&"'>尾页</a>"
   End if
if PageAll>1 then
response.write (" <a href='article.asp?id=" &  rs("id") & "&amp;class="&ids&"&amp;p="&p&"&amp;w=1&amp;sid="&sid&"&amp;saytk="&saytk&"'>全文</a>")
       response.write "(" & i+1 & "/" & PageAll & ")"
If saytk=100 Then Response.Write "</dt><dd>"

	   if saytk>1 then
	Response.write "<form name=""form"" method=""post"" action=""article.asp?id="&id&"&amp;class="&ids&"&amp;p="&p&"&amp;sid="&sid&"&amp;saytk="&saytk&""">"

%>
<br/>第<input name="ii" title="页码" type="text" size="4" value="<%=i+2%>" maxlength="4"/>
<%
response.write "<input type=""submit"" name=""submit"" value=""跳页""/></form>"

Else
%>
<br/>第<input name="i<%=minute(now)%><%=second(now)%>" title="页码" type="text" format="*N" emptyok="true" size="2" value="<%response.write(i+2)%>" maxlength="2"/>

<anchor>跳页
    <go href="article.asp?id=<%=id%>&amp;class=<%=ids%>&amp;p=<%=p%>&amp;sid=<%=sid%>&amp;saytk=<%=saytk%>" accept-charset='utf-8'>
        <postfield name="ii" value="$(i<%=minute(now)%><%=second(now)%>)"/>
    </go>
</anchor><br/>
<%end If

end If
If saytk=100 Then Response.Write "</dd><dd></dd></dl>"
Else

response.write("-----------<br/>" & ubb1(content) & "")
If saytk=100 Then Response.Write "</div><dl class=""conmore""><dt>"

response.write ("<br/><a href='article.asp?id=" &  rs("id") & "&amp;class="&ids&"&amp;p="&p&"&amp;sid="&sid&"'>分页显示</a>")
If saytk=100 Then Response.Write "</dt><dd></dd></dl>"
end if 

If saytk=100 Then Response.Write "<div class=""content"">"

response.write "<br/>当前设置" &viewtnums& "字/页<br/>"

response.write "<a href='article.asp?id=" &  rs("id") & "&amp;class="&ids&"&amp;p="&p&"&amp;nums=500&amp;sid="&sid&"'>500</a>|"
response.write "<a href='article.asp?id=" &  rs("id") & "&amp;class="&ids&"&amp;p="&p&"&amp;nums=800&amp;sid="&sid&"'>800</a>|"
response.write "<a href='article.asp?id=" &  rs("id") & "&amp;class="&ids&"&amp;p="&p&"&amp;nums=2000&amp;sid="&sid&"'>2000</a>"


%><br/>
<a href='getbook.asp?id=<%=id%>&amp;class=<%=ids%>&amp;p=<%=p%>&amp;url=/article.asp-w-id-d-<%=id%>-a-class-d-<%=ids%>&amp;sid=<%=sid%>&amp;saytk=<%=saytk%>'>添加书签</a><%response.write "|<a href='downtxt.asp?id=" &  rs("id") & "&amp;class="&ids&"&amp;p="&p&"&amp;sid="&sid&"'>下载全文</a><br/>"

classdd=rs("id")

rs.close
set rs=nothing



set rs=Server.CreateObject("ADODB.Recordset")
rs.open"select * from pl where smsid="&id&" order by id desc",conn,1,1
If rs.eof Then

	response.write"暂时没有评论！<br/>"					
else

rs.Move(0)
j=1

do while ((not rs.EOF) and j <=5)	
response.write""&j&".<a href=""bbs/uinfo.asp?id="&rs("uid")&"&amp;sid="&sid&"&amp;saytk="&saytk&""">"&ubb(rs("ip"))&"</a>:"&rs("pl")&"("&fordate(rs("pltime"))&")<br/>"

rs.MoveNext
j=j+1
loop
end if
If saytk=100 Then Response.Write "</div>"
rs.close
set rs=Nothing
If saytk=100 Then
%><div class="plbox">
<div class="pltit">您有什么想说的</div>
<dl class="plcon"><dt>
<form action="listbbs.asp?id=<%=classdd%>&amp;class=<%=ids%>&amp;p=<%=p%>&amp;sid=<%=sid%>&amp;saytk=<%=saytk%>" method="POST" name="form1">
<textarea name="pl" id="content" class="hy_input"></textarea>
</dt><dd><input type="image" src="/main/img/tjbtn.gif" /></form>
<a href='pilist.asp?id=<%=id%>&amp;class=<%=ids%>&amp;p=<%=p%>&amp;sid=<%=sid%>&amp;saytk=<%=saytk%>'>更多评论(<%=Counts%>)</a>
</dd>
</dl></div>

<%
else

if saytk=>2 then
Response.write "<form name=""form"" method=""post"" action=""listbbs.asp?id="&classdd&"&amp;class="&ids&"&amp;p="&p&"&amp;sid="&sid&"&amp;saytk="&saytk&""">"
end if%>
<input type="text" name="pl" title="输入内容" value="" maxlength="50"/><br/>
<%if saytk=>2 then
response.write "<input type=""submit"" name=""Submit"" value=""发表评论""></form><br/>"
%><a href='pilist.asp?id=<%=id%>&amp;class=<%=ids%>&amp;p=<%=p%>&amp;sid=<%=sid%>&amp;saytk=<%=saytk%>'>更多评论(<%=Counts%>)</a><br/><%
else
%>
<anchor title="确定">发表评论
<go method="post" href="listbbs.asp?id=<%=classdd%>&amp;class=<%=ids%>&amp;p=<%=p%>&amp;sid=<%=sid%>&amp;saytk=<%=saytk%>">
<postfield name="pl" value="$(pl)"/>
</go></anchor>|<a href='pilist.asp?id=<%=id%>&amp;class=<%=ids%>&amp;p=<%=p%>&amp;sid=<%=sid%>&amp;saytk=<%=saytk%>'>更多评论(<%=Counts%>)</a><br/><%
End If
End if

If saytk=100 Then Response.Write "<div class=""content"">"

set rs1=server.createobject("adodb.recordset")
sql="select top 1 ID,test,title,classid from sms where classid="&IDS&" AND id<"&id&" order by id desc"
rs1.open sql,conn,1,1
if rs1.recordcount>0 Then

%>
<a href="article.asp?id=<%=rs1("id")%>&amp;class=<%=rs1("classid")%>&amp;p=<%=p%>&amp;sid=<%=sid%>&amp;saytk=<%=saytk%>">上篇&gt;&gt;<%=ubb(rs1("title"))%></a><br/>
<%
end if
rs1.close
set rs1=nothing
set rs2=server.createobject("adodb.recordset")
sql="select top 1 ID,test,title,classid from sms where classid="&IDS&" AND id>"&id&" order by id asc"
rs2.open sql,conn,1,1

if rs2.recordcount>0 then
%>
<a href="article.asp?id=<%=rs2("id")%>&amp;class=<%=rs2("classid")%>&amp;p=<%=p%>&amp;sid=<%=sid%>&amp;saytk=<%=saytk%>">下篇&lt;&lt;<%=ubb(rs2("title"))%></a><br/>
<%end if
rs2.close
set rs2=nothing
If saytk=100 Then Response.Write "</div>"

If saytk=100 Then Response.write "<div class=""path"">"
%>
<a href='index.asp?sid=<%=sid%>&amp;saytk=<%=saytk%>'>首页</a>>
<a href='list.asp?class=<%=ids%>&amp;sid=<%=sid%>&amp;saytk=<%=saytk%>'><%=classname%></a>>正文
<%
If saytk=100 Then 
Response.write "</div>"
else
Response.write "<br/>"
End If
%><dl class="rec"><dt>热点推荐</dt></dl><%
Call hottitle(5,ids)

'-------------------
'随机广告开始
if adsetkf("ads4")=1 then
call adstr(4)
response.write"<br/>"&chr(13)
end if
'-------------------



if myid<>0 then
mz="[url=/bbs/uinfo.asp?id="&myid&"&amp;saytk=[saytk]&amp;sid=[sid]]"&myni&"[/url]"
else
mz="游客"&Replace(time(),":","")&""
end if
conn.execute("insert into sqdt(shijian,dz)values('"&now&"','"&mz&"阅读了文章(url=/article.asp?class="&ids&"&amp;id="&id&"&amp;saytk=[saytk]&amp;sid=[sid])"&titlewen&"(/url)')")

conn.close   
set conn=Nothing
Response.Write""&ubbcode(sayfanhui)&""
call head1()
%>