PHP Filter form submitted by the HTML and other dangerous code, PHP filter form submission
PHP's HTML code to filter submission forms may have code that is exploited to introduce external dangerous content. For example, there are times when a user submits a form that contains HTML content, but this can cause the Display page layout to be cluttered and filtered out.
Method One:
Copy the Code code as follows:
Get Post Data
function Postget ($str, $post =0)
{
Empty ($str) die (' Para is null '. $str. '! '): ';
if ($post)
{
if (GET_MAGIC_QUOTES_GPC ())
{
Return Htmlspecialchars (Isset ($_post[$str])? $_post
[$str]: ');
}
Else
{
Return Addslashes (Htmlspecialchars (Isset ($_post[$str])?
$_post[$str]:);
}
}
Else
{
if (GET_MAGIC_QUOTES_GPC ())
{
Return Htmlspecialchars (Isset ($_get[$str]) $_get[$str]: ');
}
Else
{
Return Addslashes (Htmlspecialchars (Isset ($_get[$str])?
$_get[$str]:);
}
}
}
Method Two:
Copy CodeThe code is as follows:
function uhtml ($STR)
{
$farr = Array (
"/\s+/",//filter Extra blanks
Filter