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