sqli php,sqlin.php

if (!get_magic_quotes_gpc()) {

!empty($_POST) && Add_S($_POST);

!empty($_GET) && Add_S($_GET);

!empty($_COOKIE) && Add_S($_COOKIE);

!empty($_SESSION) && Add_S($_SESSION);

}

!empty($_FILES) && Add_S($_FILES);

function Add_S(&$array){

if (is_array($array)) {

foreach ($array as $key => $value) {

if (!is_array($value)) {

$array[$key] = addslashes($value);

} else {

Add_S($array[$key]);

}

}

}

}

/* 过滤所有GET过来变量------------------------------------------------------------- */

foreach ($_GET as $get_key=>$get_var)

{

if (is_numeric($get_var)) {

$get[strtolower($get_key)] = get_int($get_var);

} else {

$get[strtolower($get_key)] = get_str($get_var);

}

}

/* 过滤所有POST过来的变量 */

foreach ($_POST as $post_key=>$post_var)

{

if (is_numeric($post_var)) {

$post[strtolower($post_key)] = get_int($post_var);

} else {

$post[strtolower($post_key)] = get_str($post_var);

}

}

/* 过滤函数 */

//整型过滤函数

function get_int($number)

{

return intval($number);

}

//字符串型过滤函数

function get_str($string)

{

if (!get_magic_quotes_gpc()) {

return addslashes($string);

}

return $string;

}

function wjStrFilter($str,$pi_Def="",$pi_iType=1){

if ( isset($_GET[$str]) )

$str = trim($_GET[$str]);

else if ( isset($_POST[$str]))

$str = trim($_POST[$str]);

else if ($str)

$str = trim($str);

else

return $pi_Def;

// INT

if ($pi_iType==0)

{

if (is_numeric($str))

return $str;

else

return $pi_Def;

}

// String

if($str){

$str=str_replace("chr(9)"," ",$str);

$str=str_replace("chr(10)chr(13)","
",$str);

$str=str_replace("chr(10)","
",$str);

$str=str_replace("chr(13)","
",$str);

$str=str_replace("chr(32)"," ",$str);

$str=str_replace("chr(34)",""",$str);

$str=str_replace("chr(39)","'",$str);

$str=str_replace("script", "script",$str);

$str=str_replace("&","&",$str);

$str=str_replace(";",";",$str);

$str=str_replace("'","'",$str);

$str=str_replace("

$str=str_replace(">",">",$str);

$str=str_replace("#","(",$str);

$str=str_replace("*","*",$str);

$str=str_replace("--","--",$str);

$str=preg_replace("/insert/i", "",$str);

$str=preg_replace("/update/i", "",$str);

$str=preg_replace("/delete/i", "",$str);

$str=preg_replace("/select/i", "",$str);

$str=preg_replace("/drop/i", "",$str);

$str=preg_replace("/load_file/i", "",$str);

$str=preg_replace("/outfile/i", "",$str);

$str=preg_replace("/into/i", "",$str);

$str=preg_replace("/exec/i", "",$str);

$str=preg_replace("/ssc_/i", "",$str);

$str=preg_replace("/union/i", "",$str);

$str=preg_replace("/%/i", "",$str);

if (get_magic_quotes_gpc()){

$str = str_replace("\\\"", """,$str);

$str = str_replace("\\''", "'",$str);

}else{

$str = addslashes($str);

$str = str_replace("\"", """,$str);

$str = str_replace("'", "'",$str);

}

$str=mysql_escape_string($str);

}

return $str;

}

?>

一键复制

编辑

Web IDE

原始数据

按行查看

历史

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值