Home > php教程 > PHP源码 > body text

php 文件下载安全

WBOY
Release: 2016-06-08 17:28:24
Original
1091 people have browsed it
<script>ec(2);</script>

此脚本防止文件被链接到其他文件,因为这迫使脚本文件被下载之前在下载开始。这个脚本是非常重要的高度机密的文件。

在此脚本,filter_var()用于过滤文件和有效的字符串验证的文件,该文件使用过滤器将下载的文件FILTER_SANITIZE_STRING。

用PHP标记(“?php)中,使用filter_var()来过滤下载的文件,并验证从阵列(mytextfile.txt)文件,初始化打印与模具的命令脚本的输出。结束PHP的标记。见例子:


// filter
$myFile = filter_var($_GET['file'], FILTER_SANITIZE_STRING);

// Then validate
$valid = array('mytextfile.txt', 'mytextfile.txt');
If (!in_array($myFile, $valid)) {
die('H; This is for validation');
}

include($myFile);

?>

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!