我应该采取哪些安全措施来防止我的文档被下载?

发布于 2024-10-26 18:26:25 字数 358 浏览 4 评论 0原文

我正在进行一个摄影师的项目。他获得了很多版权图像,并希望在带有水印的网站上显示或预览它们。他还希望为购买该特定图像的会员提供无水印的高质量原始图片下载。

我计划如下以防止未经授权的下载:
1.) 将所有没有水印的图像放在秘密文件夹中,并使用 .htaccess
阻止对其内容的访问 2.)要显示带有水印的图像,请使用preview.php文件调用它[从秘密文件中读取文件并添加水印并将其显示到浏览器]
3.) 要启用无水印下载,请使用 download.php 调用它,并在 download.php 中检查凭据,如果登录用户一切正常,则从秘密位置读取原始文件并将内容输出到浏览器。

我还应该采取其他安全措施吗?

I am with a project of a photographer. He got a lot of copyright images and want to show or preview them in a website with watermark over it. He also wants to enable download of good quality original picture without watermark of that picture to the members who paid for that specific images.

I am planning as following for preventing unauthorised download:
1.) placing all the images without the watermark in a secret folder and preventing access to its content using .htaccess
2.) to show image with watermark call it using preview.php file [read the file from secret file and add watermark and show it to browser]
3.) to enable download without watermark call it using download.php and inside download.php checking the credentials and if everything goes right with logged user then read the original file from secret location and output the content to browser.

Are there any other security measures that I should take?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

难忘№最初的完美 2024-11-02 18:26:25

无需添加 .htaccess 文件,只需将该文件夹放在网站根目录之外即可。除此之外,听起来不错。

Instead of adding a .htaccess file, just put the folder outside of your websites root directory. Other than that, sounds good.

浅黛梨妆こ 2024-11-02 18:26:25

你在这里描述的听起来不错。我可能会将照片完全放在 webroot 之外,但这与 .htaccess 相比不会产生实际差异。

What you are describing here sounds fine. I 'd probably put the photos entirely outside the webroot, but that shouldn't make a practical difference vs the .htaccess.

上课铃就是安魂曲 2024-11-02 18:26:25

您可以使用一种通常称为“热链接保护”的方法,通过该方法可以阻止使用非您自己站点的 HTTP 引荐来源网址的请求。 mod_rewrite 对此非常有用。这是一个例子:

RewriteEngine on
RewriteCond %{HTTP_REFERER} !^http(s)?://(www\.)?yourdomain.com [NC]
RewriteRule \.(jpg|jpeg|png|gif)$ - [NC,F,L]

You might use a method thats often called "hotlink protection" whereby you block requests with HTTP referers that are not your own site. mod_rewrite is very good for this. Here is an example:

RewriteEngine on
RewriteCond %{HTTP_REFERER} !^http(s)?://(www\.)?yourdomain.com [NC]
RewriteRule \.(jpg|jpeg|png|gif)$ - [NC,F,L]
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文