PHP Filter Unsafe HTML Program _php Tutorial

Source: Internet
Author: User

PHP Filtering HTML PHP Filter HTML code Filter HTML ASP filter the HTML filter the Code filter HTML tag ASP filter HTML code

Function uh ($STR)
{

$tarr = Array (
" ",
"<\\1\\2\\3>",//If you want to clear unsafe labels directly, you can leave this blank
"\\1\\2",
);


$farr = Array (
"/\s+/",//filter Extra blanks
"/< (\/?) (script|i?frame|style|html|body|title|link|meta|\?| \%) ([^>]*?) >/isu ",//Filter "/(<[^>]*) on[a-za-z]+\s*= ([^>]*>)/isu ",//filter on the JavaScript on event

);

$str = Preg_replace ($farr, $tarr, $STR);
return $str;
}

http://www.bkjia.com/PHPjc/629760.html www.bkjia.com true http://www.bkjia.com/PHPjc/629760.html techarticle PHP Filter HTML PHP Filtering HTML code Filtering HTML ASP filtering the HTML filtering the Code filtering HTML tag ASP filtering HTML code functionuh ($STR) {$tarr =array (, <\\1\\2\\3> ,//If you want to direct ...

  • Contact Us

    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.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.