<%
if guestjs<>"yes" and UserLogined<>True then
call guesterror()
response.end
end if

dim js_id,jscat_id
dim founderr,errmsg
if request.querystring("js_id")<>"" then
    if not isInteger(request.querystring("js_id")) then
    Response.Redirect "show_error.asp?eid=传值参数非法!"
    Response.End
    end if
	js_id=CLng(request("js_id"))
else
	js_id=0
end if

if request.querystring("jscat_id")<>"" then
  if not isInteger(request.querystring("jscat_id")) then
    Response.Redirect "show_error.asp?eid=传值参数非法!"
    Response.End
  end if
  jscat_id=CLng(request("jscat_id"))
else
  jscat_id=0
end if

if js_id>0 then
   sql="select * from js where js_id="&js_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	
		start="网兜电子书 - "&rs("js_name")&""
		jscat_id=CLng(rs("jscat_id"))
                rs("js_count")=rs("js_count")+1
		rs.update
        end if
end if

'=================================================
if FoundErr=True then
	Call HxErrMsg()
	response.end
end if

'=================================================
'过程名：main_js
'作  用：显示特效位置导航
'参  数：无
'=================================================
sub main_js()
if jscat_id>0 then
  Response.Write "您的位置： <a href='index.asp'>"&webname&"</a> >> <a href='jss.asp'>网兜电子书</a>" & vbCrLf
  sql="select * from jscat where jscat_id="&jscat_id
  set rs3=conn.execute(sql)
  if rs3.eof then
  Response.Redirect "show_error.asp?eid=参数错误，找不到相关的记录!"
  Response.End
  End IF
  Response.Write " >> <a href=""js.asp?jscat_id="&rs3("jscat_id")&""">"&rs3("jscat_name")&"</a>" 
  rs3.close
  set rs3=nothing 
else
  Response.Write "您的位置： <a href='index.asp'>"&webname&"</a> >> <a href='js.asp'>网兜电子书</a>" & vbCrLf
end if
end sub

'=================================================
'过程名：top_js
'作  用：热门特效排行
'参  数：n-调用条数,nn-显示长度
'        NewWindows-----是否新窗打开，True为是，False为否
'=================================================
sub top_js(n,nn,NewWindows)
dim nnn,RsHxcms
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 js ORDER by js_count DESC,js_id DESC")
do while not RsHxcms.eof
Response.Write "<tr><td height=22 class=table-xia>&nbsp;·<a href='showjs.asp?js_id="&RsHxcms("js_id")&"' Title='特效名称："&RsHxcms("js_name")&"&#13&#10查看次数："&RsHxcms("js_count")&"&#13&#10上传时间："&RsHxcms("js_date")&"' "& nnn &">"&gotTopic(RsHxcms("js_name"),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>"
end if
RsHxcms.close
set RsHxcms=nothing
Response.Write "</TABLE>" & vbCrLf
end sub

'=================================================
'过程名：best_js
'作  用：推荐特效
'参  数：n-调用条数,nn-显示长度
'        NewWindows-----是否新窗打开，True为是，False为否
'=================================================
sub best_js(n,nn,NewWindows)
dim nnn,RsHxcms
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 js where isbest = 1 order by js_id desc")
do while not RsHxcms.eof
Response.Write "<tr><td height=22 class=table-xia>&nbsp;·<a href='showjs.asp?js_id="&RsHxcms("js_id")&"' Title='特效名称："&RsHxcms("js_name")&"&#13&#10查看次数："&RsHxcms("js_count")&"&#13&#10上传时间："&RsHxcms("js_date")&"' "& nnn &">"&gotTopic(RsHxcms("js_name"),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>"
end if
RsHxcms.close
set RsHxcms=nothing
Response.Write "</TABLE>" & vbCrLf
end sub

'=================================================
'过程名：class_js
'作  用：特效分类——横排
'参  数：无
'=================================================
sub class_js()
sql="select jscat_id,jscat_name from jscat"
set rscat=server.createobject("adodb.recordset")
rscat.open sql,conn,1,1
do while not rscat.eof
if request("jscat_id")=cstr(rscat("jscat_id")) then
response.write "&nbsp;<font color=""#FF0000"">·"&rscat("jscat_name")&"</font>"
else
response.write "&nbsp;·<a href='js.asp?jscat_id="&rscat("jscat_id")&"'>"&rscat("jscat_name")&"</a>"
end if
rscat.movenext
loop
if rscat.bof and rscat.eof then
response.write "当前没有分类&nbsp;"
end if
rscat.close
set rscat=nothing
end sub

'=================================================
'过程名：class1_js
'作  用：特效分类——纵排
'参  数：无
'=================================================
sub class1_js()
sql="select jscat_id,jscat_name from jscat"
set rscat=server.createobject("adodb.recordset")
rscat.open sql,conn,1,1
do while not rscat.eof
if request("jscat_id")=cstr(rscat("jscat_id")) then
response.write "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<font color=""#FF0000"">·"&rscat("jscat_name")&"</font><br>"
else
response.write "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;·<a href='js.asp?jscat_id="&rscat("jscat_id")&"'>"&rscat("jscat_name")&"</a><br>"
end if
rscat.movenext
loop
if rscat.bof and rscat.eof then
response.write "当前没有分类&nbsp;"
end if
rscat.close
set rscat=nothing
end sub

'=================================================
'过程名：search_js
'作  用：显示特效搜索表单
'参  数：无
'=================================================
sub search_js()
Response.Write "<form name='form2' method='post' action='js.asp'><div align=center><input type='radio' name='select' value='js_name' checked class='inuptCG'>名称&nbsp;<input type='radio' name='select' value='js_desc' class='inuptCG'>内容&nbsp;<input type='radio' name='select' value='review' class='inuptCG'>评论<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'""></form>" & vbCrLf
end sub

'=================================================
'过程名：fl_js
'作  用：网页特效调用
'参  数：num-------------调用条数
'        fontnum---------标题长度
'        classid---------一级分类调用id，0为全部
'        classyes--------是否显示分类，True为是，False为否
'        NewWindows------是否新窗打开，True为是，False为否
'=================================================
sub fl_js(num,fontnum,classid,classyes,NewWindows)
Response.Write "<TABLE width='100%' cellSpacing=0 cellPadding=0 align=center border=0>" & vbCrLf
if classid=0 then
   sql="select top "&num&" * from js order by js_id DESC"
else
   sql="select top "&num&" * from js where jscat_id="&classid&" order by js_id DESC"			
end if
set rs=server.createobject("adodb.recordset")
rs.open sql,conn,1,1
do while not rs.eof
dim nnn
if NewWindows=True then
   nnn="target='_blank'"
else
   nnn=""				
end if 
sql="select jscat_id,jscat_name from jscat where jscat_id="&rs("jscat_id")
set rscat=server.createobject("adodb.recordset")
rscat.open sql,conn,1,1
Response.Write "<TR>" & vbCrLf
Response.Write "<TD height='22' class=table-xia>"
if classyes=True then 
Response.Write "<a href='js.asp?jscat_id="&rs("jscat_id")&"'>『"&left(rscat("jscat_name"),10)&"』</a>"
else
Response.Write ""&indexdot&"" 
end if
rscat.close
set rscat=nothing
Response.Write "&nbsp;·<a href='showjs.asp?js_id="&rs("js_id")&"' Title='电子书名称："&rs("js_name")&"&#13&#10查看次数："&rs("js_count")&"&#13&#10上传时间："&rs("js_date")&"' "& nnn &">"&gotTopic(rs("js_name"),fontnum)&"</a>" & vbCrLf
Response.Write "</TD><TD align=right class=table-xia>" & vbCrLf
if DateDiff("h",rs("js_date"),now())<=24 then Response.Write "<FONT color=red>"
Response.Write ""&Right("0"&month(rs("js_date")),2)&"/"&right("0"&day(rs("js_date")),2)&"</FONT>" & vbCrLf
Response.Write "</TD></TR>"
rs.movenext
loop
if rs.eof and rs.bof then
   Response.Write "<TR><TD>暂时没有电子书</TD></TR>"
end if
rs.close
set rs=nothing
Response.Write "</TABLE>" & vbCrLf
end sub

'=================================================
'过程名：displayList_js
'作  用：带分页功能的特效列表
'参  数：popjsnum-热门点击数
'        nn--------------标题长度
'        Hxperpage-----每页显示条数
'        classyes--------是否显示分类，True为是，False为否
'        NewWindows------是否新窗打开，True为是，False为否
'=================================================
sub displayList_js(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
if request.querystring("jscat_id")<>"" then
   sql="select * from js where jscat_id="&jscat_id&" order by istop desc,js_id DESC"
   Url_Add=Url_Add&"jscat_id="&jscat_id&"&"
elseif request("keyword")<>"" and (request("select")="js_name" or request("select")="js_desc" or request("select")="review") then
   sql="select * from js where "&request("select")&" like '%"&Jencode(checkspace(request("keyword")))&"%'order by istop desc,js_id DESC"
   Url_Add=Url_Add&"select="&request("select")&"&keyword="&Server.URLEncode(request("keyword"))&"&"
else
   sql="select * from js order by istop desc,js_id DESC"
end if
set rs=server.createobject("adodb.recordset")
rs.open sql,conn,1,1
totalcs=rs.recordcount
Response.Write "<table width='100%' border='1' align='center' cellspacing='0' cellpadding='0' bgcolor='#FFFFFF' bordercolor='#f0f0f0' style='border-collapse: collapse'>" & vbCrLf
Response.Write "<tr>" & vbCrLf
Response.Write "<td height=30 colSpan=7><FONT color=#b70000>&nbsp;<B>·</B></FONT>"
if request("jscat_id")<> "" then
Response.Write "本分类共有"
elseif request("select")<>"" then
Response.Write "共搜索到"
else
Response.Write "当前共有"
end if
Response.Write "<span>"&rs.recordcount&"</span>个电子书</td>" & vbCrLf
Response.Write "<TR><TD width='6%' align=Center height='26'>状态</TD><TD width='62%' align=Center>主题</TD><TD width='10%' align=Center>人气</TD><TD align='center'>发表时间</TD></TR>" & vbCrLf
if not rs.eof then
   Dim Hx_Nums,MultiPages,i
   Rs.PageSize=Hxperpage
   Rs.AbsolutePage=CurPage
   Hx_Nums=Rs.RecordCount
   MultiPages="<tr><td colspan=""4"" height='28' align=""center"">"&MultiPage(Hx_Nums,Hxperpage,CurPage,Url_Add)&"</td></tr>"
Do Until Rs.EOF OR i=Hxperpage
sql="select jscat_id,jscat_name from jscat where jscat_id="&rs("jscat_id")
set rscat=server.createobject("adodb.recordset")
rscat.open sql,conn,1,1
dim nnn
if NewWindows=True then
nnn="target='_blank'"
else
nnn=""				
end if
if rs("istop")="1" then      
folder="<img src=""img/1.gif"" title=固顶电子书>"       
else
folder="<img src=""img/4.gif"" title=普通电子书>"       
end if      
if rs("istop")="0" then      
if rs("isbest")=1 then
folder="<img src=""img/2.gif"" title=推荐电子书>"
elseif rs("js_count")>=popjsnum then
folder="<img src=""img/3.gif"" title=热门电子书>"      
else
folder="<img src=""img/4.gif"" title=普通电子书>"       
end if      
end if      
Response.Write "<TR><TD align=Center height='26'>"&folder&"</TD><TD>"
if classyes=True then Response.Write "<a href='js.asp?jscat_id="&rs("jscat_id")&"'>『"&left(rscat("jscat_name"),10)&"』</a>"
Response.Write "<a href='showjs.asp?js_id="&rs("js_id")&"' Title='电子书名称："&rs("js_name")&"&#13&#10查看次数："&rs("js_count")&"&#13&#10上传时间："&rs("js_date")&"' "& nnn &">"&gotTopic(rs("js_name"),nn)&"</a></TD><TD align=Center>"&rs("js_count")&"</TD><TD align='center'>"&rs("js_date")&"</TD></TR>" & vbCrLf
i=i+1
rs.movenext
loop
else
if rs.eof and rs.bof then
Response.Write "<tr align='center'>" & vbCrLf
Response.Write "<td align=middle height='60' colSpan=4>"
if request("jscat_id")<> "" then
Response.Write "该分类暂时没有电子书"
elseif request("keyword")<>"" then
Response.Write "没有找到包含[<b><font color=red>"&request("keyword")&"</font></b>]的电子书！"
else
Response.Write "没有任何特效，请管理员到后台添加！"
end if
Response.Write "</td></tr>" & vbCrLf
end if
end if
Response.Write(MultiPages)
Response.Write "</table>" & vbCrLf
rs.close
set rs=nothing
end sub

'=================================================
'过程名：content_js
'作  用：显示特效标题、内容
'参  数：无
'=================================================
sub content_js()
Response.Write "<SCRIPT language=javaScript src=""inc/code.js"" type=text/javascript></SCRIPT>" & vbCrLf
Response.Write "<table width=""100%"" align=""center"" cellspacing=""0"" cellpadding=""0""" & vbCrLf
Response.Write "style=""word-break:break-all;table-layout:fixed;text-align:left"">" & vbCrLf
Response.Write "<tr><td valign=""top"">" & vbCrLf
Response.Write "<br><div align=""center""><font style=""font-size:16px""><b>"&rs("js_name")&"</b></font></div><br><br>" & vbCrLf
Response.Write "<table width=""90%"" align=""center"" class=""table-top"">" & vbCrLf
Response.Write "<tr><td width=""100""></td><td align=""center"">[日期："&rs("js_date")&"]</td>" & vbCrLf
Response.Write "<td width=""100"" align=""right"">[浏览指数："&rs("js_count")&"]</td></tr>" & vbCrLf
Response.Write "</table><BR>"
Response.Write "<FORM method=post name=pad><table width='700' border='0' cellspacing='1' align='center'>" & vbCrLf
Response.Write "<tr>" & vbCrLf
Response.Write "<td Valign='TOP' style=""LINE-HEIGHT: 150%;padding: 5;"" align='center'>" & vbCrLf
Response.Write "<TEXTAREA cols=95 name=text rows=25>"&CODEStr(rs("js_desc"))&"</TEXTAREA></td>" & vbCrLf
Response.Write "</tr>" & vbCrLf
Response.Write "<tr>" & vbCrLf
Response.Write "<td align='center'>" & vbCrLf

Response.Write "</td>" & vbCrLf
Response.Write "</tr>" & vbCrLf
Response.Write "<tr>" & vbCrLf
Response.Write "<td valign='bottom'>" & vbCrLf
Response.Write "<font color=red>特别说明：</font>本站的电子书都来自网络和兜客推荐，版权归作者所有！" & vbCrLf
Response.Write "</td>" & vbCrLf
Response.Write "</tr>" & vbCrLf
Response.Write "</table></FORM>" & vbCrLf
Response.Write "</td>" & vbCrLf
Response.Write "</tr>" & vbCrLf
Response.Write "</table>" & vbCrLf
end sub

'=================================================
'过程名：contextual_js
'作  用：显示特效上下(篇)
'参  数：无
'=================================================
sub contextual_js()
set RelationArt = conn.execute("select top 1 js_id,js_name from js where js_id<"&request.querystring("js_id")&" order by js_date desc")
IF RelationArt.eof and relationArt.bof Then
Response.Write "<font color=red>·上个电子书：</font>已经没有了<BR> "    
else
Response.Write "<font color=red>·上个电子书：</font><a href=""showjs.asp?js_id=" & RelationArt(0) & """>" & relationArt(1) & "</a><BR>"   
end if   
Set RelationArt=Nothing
set RelationArt = conn.execute("select top 1 js_id,js_name from js where js_id>"&request.querystring("js_id")&" order by js_id")
IF RelationArt.eof and relationArt.bof Then
Response.Write "<font color=red>·下个电子书：</font>已经没有了"   
else
Response.Write "<font color=red>·下个电子书：</font><a href=""showjs.asp?js_id=" & RelationArt(0) & """>" & relationArt(1) & "</a></td>"  
end if  
RelationArt.close
Set RelationArt=Nothing 
end sub

'=================================================
'过程名：review_js
'作  用：显示相关特效评论
'参  数：n-显示条数；point_js-评论开关,1-开启，0-关闭
'=================================================
sub review_js(n)
dim temp,i,j
if point_js="1" then
Response.Write "<table align=""center"" width=""98%"" cellspacing=""0"" cellpadding=""0"" style=""word-break:break-all;table-layout:fixed;text-align:left"">"
if rs("review")<>"" then
temp=split(Trim(rs("review")),"|")
if n>=ubound(temp) then
j=ubound(temp)
else
j=n
end if
for i=1 to j
Response.Write "<tr><td style=""display:block;padding:0px 10px;LINE-HEIGHT: 180%"">"& temp(i) &"</td></tr>"
next
else
Response.Write "<tr><td style=""display:block;padding:0px 10px;LINE-HEIGHT: 180%"">当前没有评论</td></tr>"
end if
Response.Write "<tr><td align=""right"">相关评论<font color=#CC0000> "&rs("reviewcount")&" </font>篇，当前显示最新的<font color=#CC0000> "&n&" </font>篇。&nbsp;&nbsp;<a href=""view.asp?action=js&js_id="&rs("js_id")&"""> [查看更多评论] [发表我的评论]</a>&nbsp;&nbsp;</td></tr>"
Response.Write "</table>"
elseif point_js="0" then
Response.Write "<table width=""100%"" cellpadding=""5"" cellspacing=""0"" border=""0"">"
Response.Write "<tr><td  align=""center"">【电子书评论已关闭】"
Response.Write "</td></tr>" & vbCrLf
Response.Write "</table>" & vbCrLf
End If
rs.close
set rs=nothing
end sub

'=================================================
if request.querystring("action")="view" then
dim jsid
jsid=cint(request.querystring("js_id"))
sql="select * from js where js_id="&jsid
set rs=conn.execute(sql)
dim jsname,jsdesc
jsname=rs("js_name")
jsdesc=rs("js_desc")
rs.close
set rs=nothing
Response.Write("<title>"&jsname&"</title>"&jsdesc&"")
response.end
end if
%>

