欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  后端开发

php防注_PHP教程

程序员文章站 2022-05-11 09:04:25
...
$_POST = sql_injection($_POST);
$_GET = sql_injection($_GET);

function sql_injection($content)
{
if (!get_magic_quotes_gpc()) {
if (is_array($content)) {
foreach ($content as $key=>$value) {
$content[$key] = addslashes($value);
}
} else {
addslashes($content);
}
}
return $content;
}

www.bkjia.comtruehttp://www.bkjia.com/PHPjc/317793.htmlTechArticle$_POST=sql_injection($_POST); $_GET=sql_injection($_GET); functionsql_injection($content) { if(!get_magic_quotes_gpc()){ if(is_array($content)){ foreach($contentas$key=$value){ $con...