⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 downfile.asp

📁 本oa系统内部短信.手机短信.文件传输.公文收发.邮件服务.共享下载.内部论坛等功能
💻 ASP
字号:
<%@LANGUAGE="VBSCRIPT"%>
<%  
Response.ExpiresAbsolute=now()-1
Response.CacheControl="no-cache"
%>
<!--#include file="../../../../../Connections/gongyobngwenjianxitongvbs.asp" -->

<!--#include file="../../../../../Connections/oavbsconn.asp" -->
<%

if(request("id") <> "") then Command1__d = request("id")

if(session("names") <> "") then Command1__u = session("names")

%>
<%

if(session("names") <> "") then Command2__u = session("names")

if(request("id") <> "") then Command2__d = request("id")

%>
<%
' *** Restrict Access To Page: Grant or deny access to this page
MM_authorizedUsers=""
MM_authFailedURL="../../../../index.asp"
MM_grantAccess=false
If Session("userssdfgfhtrh") <> "" Then
  If (true Or CStr(Session("MM_UserAuthorization"))="") Or _
         (InStr(1,MM_authorizedUsers,Session("MM_UserAuthorization"))>=1) Then
    MM_grantAccess = true
  End If
End If
If Not MM_grantAccess Then
  MM_qsChar = "?"
  If (InStr(1,MM_authFailedURL,"?") >= 1) Then MM_qsChar = "&"
  MM_referrer = Request.ServerVariables("URL")
  if (Len(Request.QueryString()) > 0) Then MM_referrer = MM_referrer & "?" & Request.QueryString()
  MM_authFailedURL = MM_authFailedURL & MM_qsChar & "accessdenied=" & Server.URLEncode(MM_referrer)
  Response.Redirect(MM_authFailedURL)
End If
%>
<%dim id,url,n
id=request("id")
url=request("path")
n=request("name")
%>
<%
  Dim objFSO
  Set objFSO = Server.CreateObject("Scripting.FileSystemObject")
If not objFSO.FileExists(Server.MapPath(url)) Then
response.write"<script>alert('"&Session("names")&"很抱歉,您要的 "&n&"  文件在服务器上未找到!');location='"&request.ServerVariables("HTTP_REFERER")&"'</script>"
  response.end()
   End If%>
   <%
Dim u__MMColParam
u__MMColParam = "1"
If (Request("ID") <> "") Then 
  u__MMColParam = Request("ID")
End If
%>
<%
Dim u
Dim u_numRows
Set u = Server.CreateObject("ADODB.Recordset")
u.ActiveConnection = MM_oavbsconn_STRING
u.Source = "SELECT 上传人帐号  FROM 文件信息  WHERE ID = " + Replace(u__MMColParam, "'", "''") + ""
u.CursorType = 0
u.CursorLocation = 2
u.LockType = 1
u.Open()
u_numRows = 0
%>
<%if not u.eof or not u.bof then
dim u1
u1=u("上传人帐号")
end if%>
<%
u.Close()
Set u = Nothing
%>
<%
dim ip
ip = Request.ServerVariables("HTTP_X_FORWARDED_FOR") 
If ip = "" Then ip = Request.ServerVariables("REMOTE_ADDR")
%>
<%
Dim yidu
Dim yidu_numRows
Set yidu = Server.CreateObject("ADODB.Recordset")
yidu.ActiveConnection = MM_oavbsconn_STRING
yidu.Source = "SELECT 文件ID,阅读人帐号,阅读人姓名, 上传人帐号,阅读人部门, 下载IP, 下载时间, 下载日期 FROM 文件阅读明细wtrhy6wtrgvr467htyhgt"
yidu.CursorType = 0
yidu.CursorLocation = 3
yidu.LockType = 3
yidu.Open()
yidu.addnew
yidu("文件ID")=id
yidu("阅读人帐号")=session("userssdfgfhtrh")
yidu("阅读人姓名")=session("names")
yidu("阅读人部门")=session("bumen")
yidu("下载ip")=ip
yidu("下载时间")=now()
yidu("下载日期")=date()
yidu("上传人帐号")=u1

yidu.update
session("fdown")="yes"
yidu_numRows = 0
%>
<%
set Command1 = Server.CreateObject("ADODB.Command")
Command1.ActiveConnection = MM_oavbsconn_STRING
Command1.CommandText = "UPDATE 文件信息   SET 下载次数=下载次数+1  WHERE id=" + Replace(Command1__d, "'", "''") + " and 接收人姓名='" + Replace(Command1__u, "'", "''") + "' and 接收人是否删除='否' "
Command1.CommandType = 1
Command1.CommandTimeout = 0
Command1.Prepared = true
Command1.Execute()

%>
<%

set Command2 = Server.CreateObject("ADODB.Command")
Command2.ActiveConnection = MM_oavbsconn_STRING
Command2.CommandText = "UPDATE 文件信息   SET  是否阅读='是'  WHERE id=" + Replace(Command2__d, "'", "''") + " and 接收人姓名='" + Replace(Command2__u, "'", "''") + "' and 接收人是否删除='否' "
Command2.CommandType = 1
Command2.CommandTimeout = 0
Command2.Prepared = true
Command2.Execute()

%>
<%
Dim huizhi__MMColParam
huizhi__MMColParam = "1"
If (Request("ID") <> "") Then 
  huizhi__MMColParam = Request("ID")
End If
%>
<%
Dim huizhi__u
huizhi__u = "1"
If (Session("names")   <> "") Then 
  huizhi__u = Session("names")  
End If
%>
<%
Dim huizhi
Dim huizhi_numRows

Set huizhi = Server.CreateObject("ADODB.Recordset")
huizhi.ActiveConnection = MM_oavbsconn_STRING
huizhi.Source = "SELECT 是否回执,是否阅读,回执结果,接收人部门,文件名,接收人姓名,上传人姓名  FROM 文件信息  WHERE ID = " + Replace(huizhi__MMColParam, "'", "''") + " and 接收人姓名='" + Replace(huizhi__u, "'", "''") + "'"
huizhi.CursorType = 0
huizhi.CursorLocation = 2
huizhi.LockType = 3
huizhi.Open()
huizhi_numRows = 0
%>
<%dim juti
juti="阅读"%>
<% if huizhi("是否回执")="是" then %>

<%if huizhi("回执结果")="无" then %>
<!--#include file="../../../../../toall/sms/writeforeadfielsehuizhi.asp" -->

<%huizhi("回执结果")="成功"
huizhi.update%>
<%
huizhi.Close()
Set huizhi = Nothing
%>
<%end if%>
<%end if%>

<%
yidu.Close()
Set yidu = Nothing
%>
<%
call downloadFile(url)
function downloadFile(strFile)
	strFilename = server.MapPath(strFile)
	strFilename = server.MapPath(strFile)
	Response.Buffer = True
	Response.Clear
	Set s = Server.CreateObject("ADODB.Stream")
	s.Open
	s.Type = 1
	on error resume next
	Set fso = Server.CreateObject("Scripting.FileSystemObject")
	Set f = fso.GetFile(strFilename)
	intFilelength = f.size
	s.LoadFromFile(strFilename)
	Response.AddHeader "Content-Disposition", "attachment; filename=" & f.name
	Response.AddHeader "Content-Length", intFilelength
	Response.CharSet = "UTF-8"
	Response.ContentType = "application/octet-stream"
	Response.BinaryWrite s.Read
	Response.Flush
	s.Close
	Set s = Nothing
End Function 
%> 

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -