<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<%Option Explicit
Response.Buffer = false
response.charset = "gb2312"
%><!--#include file="inc/const.asp"-->
<!--#include file="inc/function.asp"-->
<!--#include file="inc/c_upload.asp"-->
<!--#include file="inc/cls_user.asp"-->
<%
if CheckMake=false then
response.write "对不起,请不要盗链本站资源" : response.end
elseif ALLOWGUESTDOWN=false then
dim user
set user=new cls_user
if user.islogin=false then
response.write "对不起,你还没有登录,请先登录" : response.end
end if
set user=nothing
end if
on Error resume next
dim filepath,st
filepath=server.mappath("uploadfile/"&request.querystring("file"))
set st=server.createobject("adodb.stream")
st.open
st.Type = 1
st.LoadFromFile filepath
If Err Then
err.Clear
set st=nothing
Response.Write "对不起,文件不存在或者已被删除"
Response.End
End If
dim ext,ctype
ext=right(filepath,3)
select case ext
case "zip"
ctype="application/x-zip-compressed"
case "doc"
ctype="application/msword"
case "xls"
ctype="application/vnd.ms-excel"
case "pdf"
ctype="application/pdf"
case "swf"
ctype="application/x-shockwave-flash"
case "avi"
ctype="video/avi"
case "mp3"
ctype="audio/mpeg"
case "chm"
ctype="application/octet-stream"
case else
ctype="application/octet-stream"
end select
response.contenttype=ctype
Response.BinaryWrite st.read
st.close
set st=nothing
Dim conn,connstr
ConnStr = costr
Set conn = Server.CreateObject("ADODB.Connection")
conn.open ConnStr
conn.execute "update [ar_uploadfile] set [hits]=[hits]+1 where filepath='"&filepath&"'",1,128
conn.close
set conn=nothing
%>
Sub CheckMake()
Dim Come,Here
Come=Request.ServerVariables("HTTP_REFERER")
Here=Request.ServerVariables("SERVER_NAME")
If Mid(Come,8,len(Here))<>Here Then CheckMake=false else CheckMake=true
End Sub
应该改成
Function CheckMake()
Dim Come,Here
Come=Request.ServerVariables("HTTP_REFERER")
Here=Request.ServerVariables("SERVER_NAME")
If Mid(Come,8,len(Here))<>Here Then CheckMake=false else CheckMake=true
End Function