0

我正在开发类似游戏商店的东西。服务器上有很多exe游戏的目录。Fe url 到游戏看起来像http://site.com/games/gametitle.exe 我需要保护 url 免受多次下载。我可以将 md5 用户的 ip 包含在 URL http://site.com/games/md5 ($ip)/gametitle.exe 中,但是如何处理呢?

4

2 回答 2

2

看看 usingreadfile并将header文件内容传递到页面,并使用会话来跟踪用户访问链接的次数。

于 2012-12-18T09:23:49.363 回答
-2

使用以下命令创建 index.php:

if(!isset($_GET['hash'])) throw new Exception("Missing hash");

if(!isset($_GET['file'])) throw new Exception("Missing filename.");

if(!isset$_GET['hash'] == md5($_SERVER['REMOTE_ADDR'])) throw new Exception("Invalid hash");

header('Location: http://domain/files/'. $_GET['file']);

像 index.php?hash=HASH&file=filetodownload.exe 一样链接它。

于 2012-12-18T09:26:58.240 回答