php filters html and other dangerous codes submitted by forms, php filters form submissions
The html code of the PHP filter submission form may contain code that can be exploited to introduce external dangerous content. For example, sometimes the user submission form contains HTML content, but this may cause confusion in the display page layout and needs to be filtered out.
Method 1:
Copy code The code is 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 2:
Copy code The code is as follows:
function uhtml($str)
{
$farr = array(
"/s+/", //Filter excess blanks
//Filter
Latest Articles by Author
-
2024-10-22 09:46:29
-
2024-10-13 13:53:41
-
2024-10-12 12:15:51
-
2024-10-11 22:47:31
-
2024-10-11 19:36:51
-
2024-10-11 15:50:41
-
2024-10-11 15:07:41
-
2024-10-11 14:21:21
-
2024-10-11 12:59:11
-
2024-10-11 12:17:31