我正在寻找隐藏/隐藏图像src的方法。这是一个小游戏,图像名包含解决方案ex:<img src="solution.jpg">
解决方案是encode64的图像,但这是相当沉重的解决方案。建议没有100%的安全性,只是避免清楚地显示"solution.jpg“src。
发布于 2016-05-05 07:42:49
最好的解决方案是将文件路径存储在数据库中,并根据请求提供服务。使用php的一个例子是
<img src="get-image.php?id=2653" />// get image path from database
...
// output
header("Content-type: image/jpeg") // change format accordingly
header('Content-Length: ' . filesize($filepath));
ob_clean();
flush();
readfile($filepath);
die();发布于 2016-05-05 07:43:24
我知道这不是php问题,但是您可以创建基于md5哈希的php脚本来读取文件。在主脚本开始时,您可以在会话中保存散列:
session_start()
$time = array_sum(explode(' ', microtime()));
$_SESSION['hash'] = md5($time);在php脚本中,您使用的是图像。
<img src="script.php?hash=<MD5 HASH>"/>您可以检查$_GET‘散列’是否等于会话中的值:
session_start();
if (isset($_GET['hash']) && isset($_SESSION['hash']) &&
$_GET['hash'] == $_SESSION['hash']) {
header("Content-type: image/jpeg");
echo file_get_contents('your hidden image.jpg');
}https://stackoverflow.com/questions/37045054
复制相似问题