Home >Backend Development >PHP Tutorial >Alternative method for $_SERVER variable no longer protected by magic_quotes_gpc in php5

Alternative method for $_SERVER variable no longer protected by magic_quotes_gpc in php5

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOriginal
2016-07-25 09:03:351158browse
  1. $magic_quotes_gpc = get_magic_quotes_gpc();

  2. @extract(daddslashes($_COOKIE));
  3. @extract(daddslashes($_POST));
  4. @extract(daddslashes($_GET));
  5. if(!$magic_quotes_gpc) {
  6. $_FILES = daddslashes($_FILES);
  7. }

  8. //---daddslashes函数

  9. //转译字符函数
  10. function daddslashes($string) {
  11. if(!is_array($string)) return addslashes($string);
  12. foreach($string as $key => $val) $string[$key] = daddslashes($val);
  13. return $string;
  14. }
  15. ?>

复制代码


Statement:
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