最新下载
热门教程
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
php防注入代码方法 过滤所有GET POST
时间:2022-07-02 09:13:25 编辑:袖梨 来源:一聚教程网
/* 过滤所有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;
}
这里我们是告诉各位朋友关于php防注入代码方法 过滤所有GET POST哦,因为大多数据都是能过get post 方法注入,当然还有files
相关文章
- Dreamweaver怎么输入项目符号? dw项目符号的添加方法 07-12
- 燕云十六声瘦骨罗汉奇遇怎么过-瘦骨罗汉奇遇攻略 07-12
- Win11安装虚拟网卡怎么启用-图文步骤 07-12
- 使用PS结合LR制作出民国风格的复古人像照片教程 07-12
- 微信公众号怎么制作一个签到积分的功能 07-12
- 剑星尼尔DLC星之泪怎么收集 尼尔DLC星之泪位置一览 07-12