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 (); }?> |