<%
'程序名称：飞扬网站管理系统[YCMS] 
'程序作者：激情飞扬 
'作者邮箱：bgh_edu@126.com
'作者 Q Q：99686532
'作者电话：0515-8842543
'官方主页：http://www.51fy.cn
'官方论坛：http://www.51fy.cn/bbs
%>
<!--#include file="inc/conn.asp"-->
<!--#include file="inc/set.asp"-->
<%
call yecaosql()
url1=Cstr(Request.ServerVariables("HTTP_REFERER"))
url2=Cstr(Request.ServerVariables("SERVER_NAME"))
if mid(url1,8,len(url2))<>url2 then
response.write"<html><title>禁止下载</title>"& vbCrLf
response.write"<body topmargin=80 bgcolor=#eeeeee>" & vbCrLf
response.write "<TABLE cellSpacing=0 cellPadding=0  border=0 align=center>"& vbCrLf
response.write "<TR><TD vAlign=bottom align=middle><TABLE cellSpacing=1 cellPadding=0 bgColor=#e1e1e1 border=0>"& vbCrLf
response.write "<TR><TD bgColor=#ffffff><TABLE cellSpacing=1 cellPadding=0 bgColor=#d7d7d7 border=0>"& vbCrLf
response.write "<TR><TD bgColor=#ffffff><TABLE cellSpacing=1 cellPadding=0 bgColor=#969696 border=0>"& vbCrLf
response.write "<TR><TD bgColor=#ffffff><TABLE cellSpacing=0 cellPadding=1 width=""100%"" border=0>"& vbCrLf
response.write "<TR><TD align=center style=padding:4px;font-size:9pt;lin-height:150%;width:280;height:60>"& vbCrLf
response.write "<font style=""color:#969696;cursor:hand"">此资源归["&webname&"]所有！请您到本站下载["&weburl&"]！谢谢合作！</font>" & vbCrLf
response.write "</TD></TR></TABLE></TD></TR></TABLE></TD></TR></TABLE></TD></TR></TABLE></TD></TR></TABLE>" & vbCrLf
response.write "</body></html>"& vbCrLf
response.end
end if
if(request.querystring("id")<>"") then
fromid=request.querystring("id")
else
response.write"<html><title>禁止下载</title>"& vbCrLf
response.write"<body topmargin=80 bgcolor=#eeeeee>" & vbCrLf
response.write "<TABLE cellSpacing=0 cellPadding=0  border=0 align=center>"& vbCrLf
response.write "<TR><TD vAlign=bottom align=middle><TABLE cellSpacing=1 cellPadding=0 bgColor=#e1e1e1 border=0>"& vbCrLf
response.write "<TR><TD bgColor=#ffffff><TABLE cellSpacing=1 cellPadding=0 bgColor=#d7d7d7 border=0>"& vbCrLf
response.write "<TR><TD bgColor=#ffffff><TABLE cellSpacing=1 cellPadding=0 bgColor=#969696 border=0>"& vbCrLf
response.write "<TR><TD bgColor=#ffffff><TABLE cellSpacing=0 cellPadding=1 width=""100%"" border=0>"& vbCrLf
response.write "<TR><TD align=center style=padding:4px;font-size:9pt;lin-height:150%;width:280;height:60>"& vbCrLf
response.write "<font style=""color:#969696;cursor:hand"">您的操作有误哦！</font>" & vbCrLf
response.write "</TD></TR></TABLE></TD></TR></TABLE></TD></TR></TABLE></TD></TR></TABLE></TD></TR></TABLE>" & vbCrLf
response.write "</body></html>"& vbCrLf
response.end
end if
sql="select * from [YC_down] where id="&fromid&""
set rs=server.createobject("adodb.recordset")
rs.open sql,conn,1,1
myurl=rs("url"+request("url"))
title=rs("title") 
sql="UPDATE [YC_down] SET downclick=downclick+1  WHERE id="&request.querystring("id")
conn.execute (sql)
if lcase(left(myurl,7))="http://" or lcase(left(myurl,6))="ftp://" then
response.redirect myurl
else
Response.Clear
Response.ContentType="application/ms-download"
Response.AddHeader "content-disposition","attachment;filename=["&title&"]"&Mid(myurl,InStrRev(myurl,"."))&""
Set Stream=server.CreateObject("ADODB.Stream")
Stream.Type=1
Stream.Open
Stream.LoadFromFile Server.MapPath(""&myurl&"")
While Not Stream.EOS
Response.BinaryWrite Stream.Read(1024*64)
Wend
Stream.Close
Set Stream = Nothing
Response.Flush
Response.End
end if
rs.close
set rs=nothing
call closedata()
%> 
