register_global = off magic_quotes_gpc = off display_error = off log_error = on # allow_url_fopen = off expose_php = off open_basedir = safe_mode = on disable_function = exec,system,passthru,shell_exec,escapeshellarg,escapeshellcmd,proc_close,proc_open,dl,popen,show_source,get_cfg_var safe_mode_include_dir =
DB SQL预处理 mysql_real_escape_string (很多PHPer仍在依靠addslashes防止SQL注入,但是这种方式对中文编码仍然是有问题的。addslashes的问题在于黑客可以用 0xbf27来代替单引号,GBK编码中0xbf27不是一个合法字符,因此addslashes只是将0xbf5c27,成为一个有效的多字节字符,其 中的0xbf5c仍会被看作是单引号,具体见这篇文章)。用mysql_real_escape_string函数也需要指定正确的字符集,否则依然可能 有问题。
HTML Purifier: HTML Purifier is a standards-compliant HTML filter library written in PHP. PHP HTML Sanitizer: Remove unsafe tags and attributes from HTML code htmLawed: PHP code to purify & filter HTML
上传文件 用is_uploaded_file和move_uploaded_file函数,使用HTTP_POST_FILES[]数组。并通过去掉上传目录的PHP解释功能来防止用户上传php脚本。 ZF框架下可以考虑使用File_upload模块 Session,Cookie和Form的安全处理 不要依赖Cookie进行核心验证,重要信息需要加密, Form Post之前对传输数据进行哈希, 例如你发出去的form元素如下:
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