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

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

if cs_id>0 then
   sql="select * from coolsites where cs_id="&cs_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
			csurl=rs("cs_url")
                        rs("cs_count")=rs("cs_count")+1
			rs.update
                        rs.close
                        set rs=nothing
                        response.redirect csurl
		end if
        end if
end if

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

'=================================================
'过程名：main_web
'作  用：显示酷站位置导航
'参  数：无
'=================================================
sub main_web()
if cscat_id>0 then
  Response.Write "您的位置： <a href='index.asp'>"&webname&"</a> >> <a href='web.asp'>酷站推荐</a>" & vbCrLf
  sql="select * from cscat where cscat_id="&cscat_id
  set rs3=conn.execute(sql)
  if rs3.eof then
  Response.Redirect "show_error.asp?eid=参数错误，找不到相关的记录!"
  Response.End
  End IF
  Response.Write " >> <a href=""web.asp?cscat_id="&rs3("cscat_id")&""">"&rs3("cscat_name")&"</a>" 
  rs3.close
  set rs3=nothing 
else
  Response.Write "您的位置： <a href='index.asp'>"&webname&"</a> >> <a href='web.asp'>酷站推荐</a>" & vbCrLf
end if
end sub

'=================================================
'过程名：top_web
'作  用：热门酷站排行_图片显示
'参  数：n-调用条数
'=================================================
sub top_web(n)
Response.Write "<TABLE width='100%' cellSpacing=0 cellPadding=0 border=0 align='center'>" & vbCrLf
set rst=server.createobject("adodb.recordset")
set rst=conn.execute("SELECT top "&n&" * FROM coolsites where passed=0 ORDER by cs_count DESC,cs_id DESC")
do while not rst.eof
Response.Write "<tr><td style=""PADDING-RIGHT: 9px; PADDING-LEFT: 8px; PADDING-BOTTOM: 5px; PADDING-TOP: 5px"" align=middle><SCRIPT type=text/javascript>hx66img('"&rst("cs_pic")&"','web.asp?action=go&cs_id="&rst("cs_id")&"','网站名称："&rst("cs_name")&"&#13&#10网站地址："&rst("cs_url")&"&#13&#10点击次数："&rst("cs_count")&"次');</SCRIPT></td></tr>" & vbCrLf
rst.movenext
loop
if rst.bof and rst.eof then
Response.Write "<tr><td align='center' valign='middle'>当前没有酷站！</td></tr>"
end if
rst.close
set rst=nothing
Response.Write "</TABLE>" & vbCrLf
end sub

'=================================================
'过程名：best_web
'作  用：推荐酷站
'参  数：n-调用条数
'=================================================
sub best_web(n)
Response.Write "<TABLE width='100%' cellSpacing=0 cellPadding=0 border=0 align='center'>" & vbCrLf
set rsb=server.createobject("adodb.recordset")
set rsb=conn.execute("SELECT top "&n&" * FROM coolsites where isbest = 1 order by cs_id desc")
do while not rsb.eof
Response.Write "<tr><td style=""PADDING-RIGHT: 9px; PADDING-LEFT: 8px; PADDING-BOTTOM: 5px; PADDING-TOP: 5px"" align=middle><SCRIPT type=text/javascript>hx66img('"&rsb("cs_pic")&"','web.asp?action=go&cs_id="&rsb("cs_id")&"','网站名称："&rsb("cs_name")&"&#13&#10网站地址："&rsb("cs_url")&"&#13&#10点击次数："&rsb("cs_count")&"次');</SCRIPT></td></tr>" & vbCrLf
rsb.movenext
loop
if rsb.bof and rsb.eof then
Response.Write "<tr><td align='center' valign='middle'>没有推荐酷站！</td></tr>"
end if
rsb.close
set rsb=nothing
Response.Write "</TABLE>" & vbCrLf
end sub

'=================================================
'过程名：class_web
'作  用：酷站分类——纵排
'参  数：无
'=================================================
sub class_web()
sql="select cscat_id,cscat_name from cscat"
set rscat=server.createobject("adodb.recordset")
rscat.open sql,conn,1,1
do while not rscat.eof
if request("cscat_id")=cstr(rscat("cscat_id")) then
response.write "&nbsp;&nbsp;&nbsp;<font color=""#FF0000"">·"&rscat("cscat_name")&"</font>"
else
response.write "&nbsp;&nbsp;&nbsp;·<a href='?cscat_id="&rscat("cscat_id")&"'>"&rscat("cscat_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

'=================================================
'过程名：search_web
'作  用：显示酷站搜索表单
'参  数：无
'=================================================
sub search_web()
Response.Write "<form name='form2' method='post' action='web.asp'><div align=center><input type='radio' name='select' value='cs_name' checked class='inuptCG'>名称&nbsp;<input type='radio' name='select' value='cs_desc' class='inuptCG'>内容&nbsp;<input type='radio' name='select' value='tjuser' 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

'=================================================
'过程名：displayList_web
'作  用：带分页功能的酷站列表
'参  数：nn-标题长度,Hxperpage-每页显示条数
'=================================================
sub displayList_web(nn,Hxperpage)
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("cscat_id")<>"" then
  sql="select * from coolsites where cscat_id="&cscat_id&" and passed=0 order by cs_id DESC"
  Url_Add=Url_Add&"cscat_id="&cscat_id&"&"
elseif request("keyword")<>"" and (request("select")="cs_name" or request("select")="cs_desc" or request("select")="tjuser") then
  sql="select * from coolsites where "&request("select")&" like '%"&Jencode(checkspace(request("keyword")))&"%' order by cs_id DESC"
  Url_Add=Url_Add&"select="&request("select")&"&keyword="&Server.URLEncode(request("keyword"))&"&"
else
sql="select * from coolsites where passed=0 order by cs_id DESC"
end if
set rs=server.createobject("adodb.recordset")
rs.open sql,conn,1,1
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=4><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></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
Response.Write "<TD style=""PADDING-RIGHT: 5px;PADDING-LEFT:5px;PADDING-BOTTOM:5px;PADDING-TOP: 5px"" align=middle><SCRIPT type=text/javascript>hx66img('"&rs("cs_pic")&"','web.asp?action=go&cs_id="&rs("cs_id")&"','网站名称："&rs("cs_name")&"&#13&#10网站地址："&rs("cs_url")&"&#13&#10点击次数："&rs("cs_count")&"次&#13&#10简单描述："&rs("cs_desc")&"');</SCRIPT><div><a href='web.asp?action=go&cs_id="&rs("cs_id")&"' Title='网站名称："&rs("cs_name")&"&#13&#10网站地址："&rs("cs_url")&"&#13&#10点击次数："&rs("cs_count")&"次&#13&#10简单描述："&rs("cs_desc")&"' "& nnn &">"&gotTopic(rs("cs_name"),nn)&"</a></div></TD>" & vbCrLf
i=i+1
if i mod 4 = 0 then
Response.Write "</tr>"
end if
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
%>

