网站地图    收藏   

主页 > php专栏 > php函数大全 >

php用户自定过滤非法sql注入字符串函数 - php函数

来源:自学PHP网    时间:2014-11-25 00:27 作者: 阅读:次

[导读] functionuc_addslashes($string,$force=0,$strip=false){!defined(#39;magic_quotes_gpc#39;)define(#39;magic_quotes_gpc#39;,get_m......

php用户自定过滤非法sql注入字符串函数

  1. function uc_addslashes($string, $force = 0, $strip = false) { 
  2.  !defined('magic_quotes_gpc') && define('magic_quotes_gpc', get_magic_quotes_gpc()); 
  3.  if(!magic_quotes_gpc || $force) { 
  4.   if(is_array($string)) { 
  5.    foreach($string as $key => $val) { 
  6.     $string[$key] = uc_addslashes($val, $force, $strip); 
  7.    } 
  8.   } else { 
  9.    $string = addslashes($strip ? strips教程lashes($string) : $string); 
  10.   } 
  11.  } 
  12.  return $string; 
  13. } 
  14.  
  15. if(!function_exists('daddslashes')) { 
  16.  function daddslashes($string, $force = 0) { 
  17.   return uc_addslashes($string, $force); 
  18.  } 
  19. } 
  20.  
  21. //php 过滤函数应用实例phpfensi.com 
  22.  
  23. $get = $_get; 
  24. $g = uc_addslashes($get, $force = 0, $strip = false); 
  25.  
  26. //过滤post提交数据 
  27.  
  28. $post =  $_post; 
  29. $p = uc_addslashes($post, $force = 0, $strip = false); 

自学PHP网专注网站建设学习,PHP程序学习,平面设计学习,以及操作系统学习

京ICP备14009008号-1@版权所有www.zixuephp.com

网站声明:本站所有视频,教程都由网友上传,站长收集和分享给大家学习使用,如由牵扯版权问题请联系站长邮箱904561283@qq.com

添加评论