Add interference codes to wordpress to prevent collection _ PHP Tutorial

Source: Internet
Author: User
Add interference codes to wordpress to prevent collection. Open the post-template.php under wp-uplodes and add the code to the reference content below the first line of the post-template.php: functionRndString ($ body) {Maximum interval distance (if the post-template.php under wp-pair des is not enabled during detection

Add the code to the first line of the post-template.php first

Reference content is as follows:
Function RndString ($ body)
{
// Maximum interval (if the p mark is not detected, add the maximum interval of the confusion string)
$ Maxamp; Pos = 1024;
// Font color
$ FontColor = "# FFFFFF ";
// P span p-tagged random style
$ St1 = chr (mt_rand (ord ("A"), ord ("Z "))). chr (mt_rand (ord ("a"), ord ("z "))). chr (mt_rand (ord ("a"), ord ("z "))). mt_rand (100,999 );
$ St2 = chr (mt_rand (ord ("A"), ord ("Z "))). chr (mt_rand (ord ("a"), ord ("z "))). chr (mt_rand (ord ("a"), ord ("z "))). mt_rand (100,999 );
$ St3 = chr (mt_rand (ord ("A"), ord ("Z "))). chr (mt_rand (ord ("a"), ord ("z "))). chr (mt_rand (ord ("a"), ord ("z "))). mt_rand (100,999 );
$ St4 = chr (mt_rand (ord ("A"), ord ("Z "))). chr (mt_rand (ord ("a"), ord ("z "))). chr (mt_rand (ord ("a"), ord ("z "))). mt_rand (100,999 );
$ Rndstyle [1] ["value"] = ". {$ st1} {display: none ;}";
$ Rndstyle [1] ["name"] = $ st1;
$ Rndstyle [2] ["value"] = ". {$ st2} {display: none ;}";
$ Rndstyle [2] ["name"] = $ st2;
$ Rndstyle [3] ["value"] = ". {$ st3} {display: none ;}";
$ Rndstyle [3] ["name"] = $ st3;
$ Rndstyle [4] ["value"] = ". {$ st4} {display: none ;}";
$ Rndstyle [4] ["name"] = $ st4;
$ Mdd = mt_rand (1, 4 );
// Do not change the content later if you do not understand the meaning.
//-----------------
$ RndstyleValue = $ rndstyle [$ mdd] ["value"];
$ RndstyleName = $ rndstyle [$ mdd] ["name"];
$ ReString ="";
// Host Mark
$ Rndem [1] = "font ";
$ Rndem [2] = "p ";
$ Rndem [3] = "span ";
$ Rndem [4] = "p ";
// Read string data
$ Fp = fopen (dirname (_ FILE _). "/RndString. php", "r ");
$ Start = 0;
$ Totalitem = 0;
While (! Feof ($ fp )){
$ V = trim (fgets ($ fp, 128 ));
If ($ start = 1 ){
If (ereg ("# end #", $ v) break;
If ($ v! = "" {$ Totalitem ++; $ rndstring [$ totalitem] = ereg_replace ("#,", "", $ v );}
}
If (ereg ("# start #", $ v) {$ start = 1 ;}
}
Fclose ($ fp );
// Process fields to prevent collection
$ Bodylen = strlen ($ body)-1;
$ Prepos = 0;
For ($ I = 0; $ I <= $ bodylen; $ I ++ ){
If ($ I + 2 >=$ bodylen | $ I <50) $ reString. = $ body [$ I];
Else {
@ $ Ntag = strtolower ($ body [$ I]. $ body [$ I + 1]. $ body [$ I + 2]);
If ($ ntag ="$ Maxpos )){
$ Dd = mt_rand (1, 4 );
$ Emname = $ rndem [$ dd];
$ Dd = mt_rand (1, $ totalitem );
$ Rnstr = $ rndstring [$ dd];
If ($ emname! = "Font") $ rnstr = "<$ emname class =" $ rndstyleName "> $ rnstr ";
Else $ rnstr = "$ rnstr";
$ ReString. = $ rnstr. $ body [$ I];
$ Prepos = $ I;
}
Else $ reString. = $ body [$ I];
}
}
Unset ($ body );
Return $ reString;
} // Function End


Search


Reference content is as follows:
Function the_content (



Set this code


Reference content is as follows:
Function the_content ($ more_link_text = "(more ...)", $ Stripteaser = 0, $ more_file = "") {
$ Content = get_the_content ($ more_link_text, $ stripteaser, $ more_file );
$ Content = apply_filters ("the_content", $ content );
$ Content = str_replace ("]>", "]>", $ content );
Echo $ content;
}



Change


Reference content is as follows:
Function the_content ($ more_link_text = "(more ...)", $ Stripteaser = 0, $ more_file = "") {
$ Content = get_the_content ($ more_link_text, $ stripteaser, $ more_file );
$ Content = apply_filters ("the_content", $ content );
$ Content = str_replace ("]>", "]>", $ content );
$ Content = RndString ($ content );
Echo $ content;
}


Note that the line $ content = RndString ($ content) is added );

Upload the RndString. php file in the attachment to wp-uplodes /.


Attachment: Click here to download

Address: http://www.mylb.net.cn/2008/08/608.html

The post-template.php under incluwp-includes first adds the code to the first line of the post-template.php as reference: function RndString ($ body) {// maximum interval distance (if not detected...

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.