PHP to achieve the mask off Black hat seo search keywords

Source: Internet
Author: User
Tags strlen

I'll give you a way to do my thinking.

That's the way the big boys want to do this. Most of them still have to leave QQ or phone number

So I'm going to match the rules inside, find the number in the search, and then judge the length of the string to determine if it's a garbage search.

The code:

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22-23 <?php//@ function shielding off black hat seo search keywords//@By yang brother function findnum ($str = ') {//Remove all digits in the string $str =trim ($STR); if (empty ($str)) {Retu RN ';} $result = '; For ($i =0 $i <strlen ($STR); $i + +) {if (Is_numeric ($str [$i])) {$result. = $str [$i];}} return $result; } $the _lnum=strlen (FindNum ($q))//Get the number string length if ($the _lnum>6) {//Determine whether the length is more than 6 or more than the direct 301 to the search page header ("http/1.1, moved Permanently "); Header ("location:http://". $_server[' Http_host '). " /search.php "); Exit (); }?>
Related Article

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.