欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

php中$_GET與$_POST過(guò)濾sql注入的方法

 更新時(shí)間:2014年11月03日 10:37:28   投稿:shichen2014  
這篇文章主要介紹了php中$_GET與$_POST過(guò)濾sql注入的方法,包含了addslashes_deep函數(shù)與數(shù)組的操作方法,是非常具有實(shí)用價(jià)值的技巧,需要的朋友可以參考下

本文實(shí)例講述了php中$_GET與$_POST過(guò)濾sql注入的方法,分享給大家供大家參考。具體分析如下:

此函數(shù)只能過(guò)濾一些敏感的sql命令了,像id=1這種大家還是需要自己簡(jiǎn)單過(guò)濾了。

主要實(shí)現(xiàn)代碼如下:

復(fù)制代碼 代碼如下:
if (!get_magic_quotes_gpc())
{
if (!empty($_GET))
{
$_GET  = addslashes_deep($_GET);
}
if (!empty($_POST))
{
$_POST = addslashes_deep($_POST);
}
$_COOKIE   = addslashes_deep($_COOKIE);
$_REQUEST  = addslashes_deep($_REQUEST);
}
function addslashes_deep($value)
{
if (empty($value))
{
return $value;
}
else
{
return is_array($value) ? array_map('addslashes_deep', $value) : addslashes($value);
}
}

希望本文所述對(duì)大家的PHP程序設(shè)計(jì)有所幫助。

相關(guān)文章

最新評(píng)論