我正在开发一些类似游戏商店的东西。在服务器上有一个目录,里面有很多exe游戏。F.e.游戏的网址看起来像http://site.com/games/gametitle.exe我需要保护网址从多次下载。我可以将md5用户的ip包含到url http://site.com/games/md5($ip)/gametitle.exe中,但是如何处理它?
发布于 2012-12-18 17:23:49
看看如何使用readfile和header将文件内容传递到页面,并使用会话跟踪用户访问链接的次数。
发布于 2012-12-18 17:26:58
使用以下内容制作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一样链接它。
https://stackoverflow.com/questions/13929755
复制相似问题