Home > Backend Development > PHP Tutorial > Recommended PHP universal anti-injection program for windows tablets Recommended

Recommended PHP universal anti-injection program for windows tablets Recommended

WBOY
Release: 2016-07-29 08:44:29
Original
877 people have browsed it

Copy code The code is as follows:


function jk1986_checksql()
{
$bad_str = "and|select|update|'|delete|insert|*";
$bad_Array = explode("|",$ bad_str);
/**Filter Get parameters **/
foreach ($bad_Array as $bad_a)
{
foreach ($_GET as $g)
{
if (substr_count(strtolower($g),$bad_a) > 0)
{
echo "<script>alert('Weird characters, please do not try to inject them into this site! Author: Jk1986 QQ:414028660');location.href='index.php';</script>";
exit();
}
}
}
/**Filter Post parameters **/
foreach ($bad_Array as $bad_a)
{
foreach ($_POST as $p)
{
if (substr_count(strtolower($ p),$bad_a) > 0)
{
echo "<script>alert('Weird characters, please do not try to inject them into this site! Author: Jk1986 QQ:414028660');location.href='index.php' ;</script>";
exit();
}
}
}
/**Filter Cookies Parameters **/
foreach ($bad_Array as $bad_a)
{
foreach ($_COOKIE as $co)
{
if (substr_count(strtolower($co),$bad_a) > 0)
{
echo "<script>alert('Weird characters, please do not try to inject them into this site! Author: Jk1986 QQ:414028660');location .href='index.php';</script>";
exit();
}
}
}
}


Haha, it is similar to asp and asp.net. The idea is the same, the purpose is to let laziness improve efficiency. 88

The above introduces the recommended PHP universal anti-injection program for Windows tablets, including the recommended content for Windows tablets. I hope it will be helpful to friends who are interested in PHP tutorials.

Related labels:
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