<legend id='9avjz'><style id='9avjz'><dir id='9avjz'><q id='9avjz'></q></dir></style></legend>
    <bdo id='9avjz'></bdo><ul id='9avjz'></ul>
  • <tfoot id='9avjz'></tfoot>

      <small id='9avjz'></small><noframes id='9avjz'>

      <i id='9avjz'><tr id='9avjz'><dt id='9avjz'><q id='9avjz'><span id='9avjz'><b id='9avjz'><form id='9avjz'><ins id='9avjz'></ins><ul id='9avjz'></ul><sub id='9avjz'></sub></form><legend id='9avjz'></legend><bdo id='9avjz'><pre id='9avjz'><center id='9avjz'></center></pre></bdo></b><th id='9avjz'></th></span></q></dt></tr></i><div id='9avjz'><tfoot id='9avjz'></tfoot><dl id='9avjz'><fieldset id='9avjz'></fieldset></dl></div>

      1. PHP - 保护数字下载

        PHP - Protecting digital Downloads(PHP - 保护数字下载)
        <tfoot id='qRvQ9'></tfoot>

        <small id='qRvQ9'></small><noframes id='qRvQ9'>

            • <bdo id='qRvQ9'></bdo><ul id='qRvQ9'></ul>

              <legend id='qRvQ9'><style id='qRvQ9'><dir id='qRvQ9'><q id='qRvQ9'></q></dir></style></legend>
              <i id='qRvQ9'><tr id='qRvQ9'><dt id='qRvQ9'><q id='qRvQ9'><span id='qRvQ9'><b id='qRvQ9'><form id='qRvQ9'><ins id='qRvQ9'></ins><ul id='qRvQ9'></ul><sub id='qRvQ9'></sub></form><legend id='qRvQ9'></legend><bdo id='qRvQ9'><pre id='qRvQ9'><center id='qRvQ9'></center></pre></bdo></b><th id='qRvQ9'></th></span></q></dt></tr></i><div id='qRvQ9'><tfoot id='qRvQ9'></tfoot><dl id='qRvQ9'><fieldset id='qRvQ9'></fieldset></dl></div>
                    <tbody id='qRvQ9'></tbody>
                  本文介绍了PHP - 保护数字下载的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我正在研究如何保护 PHP 中的数字下载.只需要一些大致的方向,这样我就可以开始我的研究.我似乎找不到任何有用的东西.

                  I'm trying figure out how I can protect digital downloads in PHP. Just need some general directions so I can start my research. I don't seem to be able to find anything useful.

                  我想让我的用户可以下载文件,但不希望他们能够直接访问下载文件夹.另外,我希望下载链接只能在设定的时间段内或单次下载内使用.

                  I want to make files available for my users to download but don't want them to be able to directly access a download folder. Also, I want the download link to be available only for set period of time or a single download.

                  有人能指出我正确的方向吗?

                  Could some one point me in the right direction?

                  推荐答案

                  最好的方法是在您检查后将下载管理委托给 apache 的 mod

                  The best way is to delegate the download managment after your check to the mod for apache

                  x_sendfile
                  

                  https://tn123.org/mod_xsendfile/

                  用法:

                  <?php
                  ...
                  if ($user->isLoggedIn())
                  {
                      header("X-Sendfile: $path_to_somefile");
                      header("Content-Type: application/octet-stream");
                      header("Content-Disposition: attachment; filename="$somefile"");
                      exit;
                  }
                  ?>
                  <h1>Permission denied</h1>
                  <p>Login first!</p>
                  

                  基本上,当您发送标头 X-Sendfile 时,mod 会拦截该文件并为您管理下载(该文件可以随时位于虚拟主机之外).

                  Basically when you send the header X-Sendfile the mod intercepts the file and manages the download for you (the file can be located whenever you want outside the virtualhost).

                  否则你可以只实现一个简单的文件download.php,它获取文件的id并在登录检查后用readfile打印内容

                  Otherwise you can just implement a simple file download.php that gets the id of the file and prints the contents with readfile after the login check

                  这篇关于PHP - 保护数字下载的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  Is PHP or PHP based web framework stateful or stateless?(PHP 或基于 PHP 的 Web 框架是有状态的还是无状态的?)
                  How to parse django style template tags(如何解析 django 样式模板标签)
                  What is a good setup for editing PHP in Emacs?(在 Emacs 中编辑 PHP 的好设置是什么?)
                  How to check whether specified PID is currently running without invoking ps from PHP?(如何在不从 PHP 调用 ps 的情况下检查指定的 PID 当前是否正在运行?)
                  What#39;s the difference between escapeshellarg and escapeshellcmd?(escapeshellarg 和escapeshellcmd 有什么区别?)
                  php in background exec() function(php 后台 exec() 函数)
                • <i id='W8P49'><tr id='W8P49'><dt id='W8P49'><q id='W8P49'><span id='W8P49'><b id='W8P49'><form id='W8P49'><ins id='W8P49'></ins><ul id='W8P49'></ul><sub id='W8P49'></sub></form><legend id='W8P49'></legend><bdo id='W8P49'><pre id='W8P49'><center id='W8P49'></center></pre></bdo></b><th id='W8P49'></th></span></q></dt></tr></i><div id='W8P49'><tfoot id='W8P49'></tfoot><dl id='W8P49'><fieldset id='W8P49'></fieldset></dl></div>

                    <tfoot id='W8P49'></tfoot>

                      <small id='W8P49'></small><noframes id='W8P49'>

                        <bdo id='W8P49'></bdo><ul id='W8P49'></ul>
                        1. <legend id='W8P49'><style id='W8P49'><dir id='W8P49'><q id='W8P49'></q></dir></style></legend>

                            <tbody id='W8P49'></tbody>