PHP头条
热点:

PHP 防止sql注入函数代码


PHP 防止sql注入函数代码:
  1. <?php
  2. $magic_quotes_gpc = get_magic_quotes_gpc();
  3. @extract(daddslashes($_COOKIE));
  4. @extract(daddslashes($_POST));
  5. @extract(daddslashes($_GET));
  6. if(!$magic_quotes_gpc) {
  7.         $_FILES = daddslashes($_FILES);
  8. }
  9. function daddslashes($string, $force = 0) {
  10.         if(!$GLOBALS[magic_quotes_gpc] || $force) {
  11.                 if(is_array($string)) {
  12.                     foreach($string as $key => $val) {
  13.                         $string[$key] = daddslashes($val, $force);
  14.                     }
  15.                 } else {
  16.                     $string = addslashes($string);
  17.                 }
  18.         }
  19.         return $string;
  20. }
  21. ?>

www.phpzy.comtrue/phprm/23352.htmlTechArticlePHP 防止sql注入函数代码 PHP 防止sql注入函数代码: ?php $magic_quotes_gpc = get_magic_quotes_gpc(); @extract(daddslashes($_COOKIE)); @extract(daddslashes($_POST)); @extract(daddslashes($_GET)); if(!$magic_quotes_gpc) { $_FIL...

相关文章

    暂无相关文章

PHP之友评论

今天推荐