<%
dim totalfl,passing,lk
sql="select fl_id from friendlink"
set rs=server.createobject("adodb.recordset")
rs.open sql,conn,1,1
totalfl=rs.recordcount
rs.close

sql="select fl_id from friendlink where passed=1"
set rs=server.createobject("adodb.recordset")
rs.open sql,conn,1,1
passing=rs.recordcount
rs.close

sql="select fl_id from friendlink where lk=1"
set rs=server.createobject("adodb.recordset")
rs.open sql,conn,1,1
lk=rs.recordcount
rs.close
set rs=nothing

'=================================================
'过程名：tj_link
'作  用：提交信息表单
'参  数：无
'=================================================
sub tj_link()
Response.Write "<TABLE width='100%' cellSpacing=0 cellPadding=0 border=0 align='center'>" & vbCrLf
if EnableLinkReg<>"yes" then
Response.Write"<tr>" & vbCrLf
Response.Write"<td>&nbsp;<font color=#FF0000>·</font>本站已停止自助友情链接申请，需做链接请联系本站管理员，谢谢你的支持！！</td>" & vbCrLf
Response.Write"</tr>" & vbCrLf
else
Response.Write"<tr>" & vbCrLf
Response.Write"<td><iframe name='Hx66' style=""display:none""></iframe><form name='form' method='post' action='relink.asp' target='Hx66' onsubmit=""return link()"">" & vbCrLf
Response.Write"<div style=""padding-top:5px;"">&nbsp;类别:<select name='flcat_id' id='flcat_id' class='input'>" & vbCrLf
sql="select * from flcat"
set rs=server.CreateObject("adodb.recordset")
rs.open sql,conn,1,1
do while not rs.eof
Response.Write"<option value='"&rs("flcat_id")&"'>"&rs("flcat_name")&"</option>" & vbCrLf
rs.movenext
loop
if rs.bof and rs.eof then
Response.Write"<option value='0'>暂无分类</option>" & vbCrLf
end if
rs.close
set rs=nothing
Response.Write"</select></div>" & vbCrLf
Response.Write"<div style=""padding-top:5px;"">&nbsp;名称:<input type='text' name='fl_name' size='18' autocomplete='off' class='input'></div>" & vbCrLf
Response.Write"<div style=""padding-top:5px;"">&nbsp;地址:<input type='text' name='fl_url' size='18' value='http://' autocomplete='off' class='input'></div>" & vbCrLf
Response.Write"<div style=""padding-top:5px;"">&nbsp;图标:<input type='text' name='fl_logo' size='18' autocomplete='off' class='input'></div>" & vbCrLf
Response.Write"<div style=""padding-top:5px;padding-bottom:5px;""><center><input type='submit' name='Submit' value='提交' class='input'>&nbsp;<input type='reset' name='reset' value='清空' class='input'></div>" & vbCrLf
Response.Write"</td></tr></form>" & vbCrLf
end if
Response.Write "</TABLE>" & vbCrLf
end sub

'=================================================
'过程名：lk_link
'作  用：黑名单列表
'参  数：无
'=================================================
sub lk_link()
Response.Write "<MARQUEE scrollAmount=2 scrollDelay=5 width='100%'>" & vbCrLf
sql="select * from friendlink where lk=1"
set rs=server.createobject("adodb.recordset")
rs.open sql,conn,1,1
for i=1 to rs.recordcount
Response.Write "<font color='#cccccc'>·"&rs("fl_name")&"</font>" & vbCrLf 
rs.movenext
next
if rs.bof and rs.eof then
Response.Write "谢谢各位站长的支持，本站当前没有黑名单链接！" & vbCrLf 
end if
rs.close
set rs=nothing
Response.Write "</MARQUEE>" & vbCrLf 
end sub

'=================================================
'过程名：logo_link
'作  用：本站 LOGO
'参  数：无
'=================================================
sub logo_link()
Response.Write "<TABLE width='100%' cellSpacing=0 cellPadding=0 border=0 align='center'>" & vbCrLf
Response.Write "<tr><td>" & vbCrLf
Response.Write "<div align=center style=""padding-top:5px;""><img border='0' src='img/logo.gif'></div>" & vbCrLf
Response.Write "<div style=""padding-top:5px;"">&nbsp;网站名称："&webname&"</div>" & vbCrLf
Response.Write "<div style=""padding-top:5px;"">&nbsp;网站地址："&weburl&"</div>" & vbCrLf
Response.Write "</td></tr>" & vbCrLf
Response.Write "</TABLE>" & vbCrLf
end sub

'=================================================
'过程名：best_link
'作  用：推荐连接
'参  数：无
'=================================================
sub best_link()
set logotop=conn.execute("select * from friendlink where Passed=0 and lk=0 and istop=1 order by fl_id Asc")
Response.Write "<TABLE width='100%' cellSpacing=10 cellPadding=0 border=0 align='center'>" & vbCrLf
Response.Write "<tr>" & vbCrLf
do while not logotop.eof
Response.Write "<td align='center'>"       
Response.Write "<a href='?action=go&fl_id="&logotop("fl_id")&"' target='_blank' title='网站名称："&logotop("fl_name")&"&#13&#10网站地址："&logotop("fl_url")&"&#13&#10加入时间："&logotop("fl_date")&"&#13&#10点击次数："&logotop("count")&"'><img src='"&logotop("fl_logo")&"' width='88' height='31' border='0' style=""text-decoration: none""></a></td>" & vbCrLf
if order=5 then response.write "</tr><tr>" & vbCrLf
if order>5 then 
		order=1
	else
		order=order+1
	end if
logotop.movenext
loop
logotop.close
set logotop=nothing
Response.Write "</tr>" & vbCrLf
Response.Write "</TABLE>" & vbCrLf
end sub

'=================================================
'过程名：List_link
'作  用：连接列表
'参  数：无
'=================================================
sub List_link()
Response.Write "<table cellpadding=4 cellspacing=2 bgcolor='#f7f7f7' width='98%' height='30' align=center style='border:1px dashed #808080;padding:20px'>" & vbCrLf
response.write "<tr><td>"
response.write "&nbsp;当前共有"&totalfl&"个友情链接，其中包含等待通过验证的"&passing&"个，黑名单"&lk&"个。"
response.write "</td></tr>" & vbCrLf
response.write "<tr><td>&nbsp;链接分类→"
sql="select * from flcat"
set rscat=server.createobject("adodb.recordset")
rscat.open sql,conn,1,1
do while not rscat.eof
if request("flcat_id")=cstr(rscat("flcat_id")) then
response.write "&nbsp;<font color=""#FF0000"">·"&rscat("flcat_name")&"</font>&nbsp;"
else
response.write "&nbsp;<a href='?flcat_id="&rscat("flcat_id")&"'>·"&rscat("flcat_name")&"</a>&nbsp;"
end if
rscat.movenext
loop
if rscat.bof and rscat.eof then
response.write "当前没有分类&nbsp;"
end if
rscat.close
set rscat=nothing
response.write "</td></tr>" & vbCrLf
Response.Write "</TABLE>" & vbCrLf
Response.Write "<TABLE width='100%' cellSpacing=5 cellPadding=0 border=0 align='center'>" & vbCrLf
if request("flcat_id")<>"" then
  if not isInteger(request("flcat_id")) then
    Response.Write "<script language=javascript>alert('参数非法');javascript:history.back();</script>"
    Response.End
  end if
end if
Dim CurPage,Url_Add
Url_Add="?"
lperpage=100
If Request.QueryString("Page")<>"" Then
   Curpage=Request.QueryString("Page")
   If IsInteger(Curpage)=False OR Curpage<0 Then Curpage=1
Else
   Curpage=1
End If
if request.querystring("flcat_id")<>"" then
   flcat_id=clng(request.querystring("flcat_id"))
   sql="select * from friendlink where flcat_id="&flcat_id&" and passed=0 and lk=0 and istop=0 order by fl_id ASC"
   Url_Add=Url_Add&"flcat_id="&flcat_id&"&"
else
   sql="select * from friendlink where passed=0 and lk=0 and istop=0 order by fl_id ASC"
end if
set rs=server.createobject("adodb.recordset")
rs.open sql,conn,1,1
if not rs.eof or not rs.bof then 
   Dim L_Nums,MultiPages,i
   rs.PageSize=lperpage
   rs.AbsolutePage=CurPage
   L_Nums=rs.RecordCount
   MultiPages="<tr><td colspan=""4"" height=""25"" align=""center"">"&MultiPage(L_Nums,lperpage,CurPage,Url_Add)&"</td></tr>"
Response.Write "<tr>" & vbCrLf
Response.Write "<td height=30 colSpan=4><FONT color=#b70000>&nbsp;<B>·</B></FONT>"
if request("flcat_id")<> "" then
Response.Write "本分类共有"
else
Response.Write "当前共有"
end if
Response.Write "<span>"&L_Nums&"</span>个链接</td></TR><TR>" & vbCrLf
Do Until Rs.EOF OR i=lperpage
response.write "<td  align='center' height=40>"
response.write "<a href='?action=go&fl_id="&rs("fl_id")&"' target='_blank' title='网站名称："&rs("fl_name")&"&#13&#10网站地址："&rs("fl_url")&"&#13&#10加入时间："&rs("fl_date")&"&#13&#10点击次数："&rs("count")&"'>"
if rs("fl_logo")<>"" then response.write "<img src='"&rs("fl_logo")&"' width='88' height='31' border='0' style='text-decoration: none'>" else response.write gotTopic(rs("fl_name"),14) end if
response.write "</a></td>"
i=i+1
if i mod 6 = 0 then
Response.Write "</tr>" & vbCrLf
end if
rs.movenext
loop
else
  Response.Write "<TR><td align=middle height='60' colSpan=4>"
  if request("flcat_id")<> "" then
     Response.Write "该分类暂时没有连接"
  else
     Response.Write "没有任何连接！"
  end if
  Response.Write "</td></tr>" & vbCrLf
end if
Response.Write(MultiPages)
Response.Write "</TABLE>" & vbCrLf
rs.close
set rs=nothing
end sub
'=================================================
'过程名：无
'作  用：连接输出、计数
'参  数：无
'=================================================
if request.querystring("action")="go" then
if request.querystring("fl_id")<>"" then
  if not isInteger(request.querystring("fl_id")) then
    Response.Write "<script language=javascript>alert('参数非法');javascript:history.back();</script>"
    response.end
  end if
end if
dim flid,flurl
flid=clng(request.querystring("fl_id"))
sql="select count,fl_url from friendlink where fl_id="&flid
set rs=server.createobject("adodb.recordset")
rs.open sql,conn,1,3
flurl=rs("fl_url")
rs("count")=rs("count")+1
rs.update
rs.close
set rs=nothing
response.redirect flurl
end if
%>

