/** * Created by JetBrains phpstorm. * USER:LSL * date:13-8-28 * Time: Afternoon 2:58 * Sensitive word Filter tool class * Use method * echo filtertools::filtercontent (" your mother i fuck color wolf hybrid two mountain food
We've already talked about how to filter out elements that are not common in the array, so let's see how PHP filters out the elements that are common to two arrays, such as filtering $array1 and $array2.Function name: Array_intersect ();Call mode:
The principle of implementation is to use Str_replace to replace RN N T, and then use regular expressions to filter some annotation tags.
The code is as follows
Copy Code
function compress_html ($string) {$string = Str_
Because this blog often encounters some curious people to do various tests, I often see all sorts of weird comments in the comments database, either a variety of double quotes, single quotes, SQL statement keywords, or some meaningless comments, so
1PHP2 3 /*4 * Php://stdin standard input stream5 * Php://stdout standard input stream6 * Php://stderr standard error stream7 * Php://output only written data stream8 * php://fd allow direct azimuth file descriptor9 *Ten * Php://memory allows both
0x01 sequenceA probe into PHP pseudo-protocolThere are so many pseudo protocols supported in PHPfile://-access to the local file system http://-Access HTTP (s) URL ftp://-access FTP (s) urlsphp://-access to each input/output stream (I/O streams)
In the past, a user obtained information through the network. Today's network is focusing more on interaction with users. Users are no longer just site viewers, but also content makers. It evolved from a simple "read" to "write" and "co-creation",
The following function can be used to filter the input of the user to ensure that the input is XSS-safe. Specifically how to filter, you can see inside the function, there are comments.
Copy CodeThe code is as follows:
function Removexss ($val)
NL2BR (); N to
Addslashes (); Strips tutorial Lashes (); Escape special characters when working with database tutorialsDefinition: the Addslashes () function adds a backslash before the specified predefined character.Syntax: Addslashes (String)Note:
Html code that uses PHP to filter submitted forms may contain code that introduces external dangerous content. For example, some forms submitted by the user contain html content, but this may cause confusion in the layout of the display page and
Php filters all html tags. First, we recommend that the filter_sanitize_string and filter_sanitize_string filters remove or encode unnecessary characters. This filter deletes data that is potentially harmful to the application. First, we recommend
There are many ways to filter special symbols. The following describes how to use regular expressions to implement them. I hope this will be helpful to you.
The code is as follows:
If (preg_match ("/['.,:;*?~ '! @ # $ % ^ & + =) (<>{}] |\] | \
#用户发布的html, filtering hazard codes
Copy the Code code as follows:
Function uh ($STR){$farr = Array ("/\s+/",//filter Extra blanks"/]*?) >/isu ",//Filter
In the past, PHP had to verify the data, which was generally implemented by programmers themselves through regular expressions. from PHP 5.2, the filter function in the original PCEL was moved to the built-in library, we have made a lot of
Class Request
{
Public Function __construct ()
{
if (!GET_MAGIC_QUOTES_GPC ())
{
if (!empty ($_post))
{
foreach ($_post as $k = & $v)
{
if (Is_array ($v))
{
@array_walk ($v, ' urldecode ');
This article mainly introduces how php filters links to other websites in html (the domain name whitelist function). For more information, see
The code is as follows:
/**
* Filter out site links* @ Param array $ local_domain this site domain
Php filters dangerous html code. The following is the program code: Copy the code as follows: functionuhtml ($ str) {$ farrarray (s +, the following program code is displayed:
The code is as follows:
Function uhtml ($ str){$ Farr = array ("// \
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.