3月 21
当magic_quotes_gpc设置为1时,GPCF的数据将被addslashes。
这里是使用程序还原原始数据的代码,相当于把magic_quotes_gpc设置为0。


if (get_magic_quotes_gpc()) { // check magic_quotes_gpc state
  function strip_quotes(&$var) {
  if (is_array($var)
    array_walk($var, 'strip_quotes');
  else
    $var = stripslashes($var);
}
// Handle GPC
foreach (array('GET','POST','COOKIE') as $v)
  if (!empty(${"_".$v}))
    array_walk(${"_".$v}, 'strip_quotes');
// Original file names may contain escaped data as well
if (!empty($_FILES))
  foreach ($_FILES as $k => $v) {
    $_FILES[$k]['name'] = stripslashes($v['name']);
}
 

或者更快的解决方法:

if (get_magic_quotes_gpc()) {
  $in = array(&$_GET, &$_POST, &$_COOKIE);
    while (list($k,$v) = each($in)) {
      foreach ($v as $key => $val) {
        if (!is_array($val)) {
          $in[$k][$key] = stripslashes($val);
          continue;
        }
      $in[] =& $in[$k][$key];
    }
  }
  unset($in);
}
 
Defined tags for this entry:

作者 rollenc

| 主要出源 (0)
请对 365 天内更新的文章进行打分
当前分数: 3.14 of 5 。 7 次打分。 222 次点击
Bookmark magic_quotes_gpc=1时的还原处理  at del.icio.us Digg magic_quotes_gpc=1时的还原处理 Mixx magic_quotes_gpc=1时的还原处理 Bloglines magic_quotes_gpc=1时的还原处理 Technorati magic_quotes_gpc=1时的还原处理 Fark this: magic_quotes_gpc=1时的还原处理 Bookmark magic_quotes_gpc=1时的还原处理  at YahooMyWeb Bookmark magic_quotes_gpc=1时的还原处理  at Furl.net Bookmark magic_quotes_gpc=1时的还原处理  at reddit.com Bookmark magic_quotes_gpc=1时的还原处理  at blinklist.com Bookmark magic_quotes_gpc=1时的还原处理  at Spurl.net Bookmark magic_quotes_gpc=1时的还原处理  at NewsVine Bookmark magic_quotes_gpc=1时的还原处理  at Simpy.com Bookmark magic_quotes_gpc=1时的还原处理  at blogmarks Bookmark magic_quotes_gpc=1时的还原处理  with wists Bookmark magic_quotes_gpc=1时的还原处理  at Ma.gnolia.com wong it! Bookmark using any bookmark manager! Stumble It!

0 引用

  1. 没有引用

0 回复

回复显示方式(直线程 | 分线程)
  1. 没有回复
作者不允许回复到这篇文章