php $_GET $_POST filter sql injection program code_PHP tutorial

WBOY
Release: 2016-07-13 10:47:50
Original
1105 people have browsed it

This article will introduce to you a php $_GET $_POST filter sql injection program code function. I hope that these functions will be helpful to your friends. This function can only filter some sensitive sql commands, such as id=1. You still need to simply filter it yourself.

The code is as follows
 代码如下 复制代码


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);
}
}

Copy code

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);
}

http://www.bkjia.com/PHPjc/632841.html
www.bkjia.com
true
http: //www.bkjia.com/PHPjc/632841.htmlTechArticleThis article will introduce to you a php $_GET $_POST filter sql injection program code function. I hope these functions will be useful to you. Friends are helpful, this function can only filter some sensitive sql commands, like...
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template