Php knows and asks about the collection plug-in code _ php skills-php Tutorial

Source: Internet
Author: User
The number of websites that have seen a Baidu thief reaches pr6. More than 100,000 !! After 40 days of provisioning, I found that Baidu is really friendly to this. I recently found that more and more versions are available to know and ask thieves !!
The number of websites that have seen a Baidu thief reaches pr6. More than 100,000 !!
After 40 days of provisioning, I found that Baidu is really friendly to this.
From the perspective of website access, many of them are also from Baidu search!
Therefore, it is feasible to fill in the website content by knowing and asking.
So I developed a collection plug-in that knows the question.
In principle, it is suitable for php + mysql and the article is in a table program.
Know the collection code

The code is as follows:


Session_start ();
Header ("content-type: text/html; charset = gbk ");
Require ("stole_config.php ");
Require ("conn. php ");
Require ("keyword. php ");
$ SearchStr = $ _ GET ["searchStr"];
$ Ss = explode ("", $ searchStr); // split the search keyword
$ Word = ""; // Enter the keyword
Foreach ($ ss as $ key => $ t)
{
If ($ key> 0)
{
$ Word. = "+ ";
}
$ Word. = urlencode ($ t );
}
$ Jl = intval ($ _ GET ['jl ']);
If (isset ($ _ GET ['Page'])
{
$ Page = intval ($ _ GET ['Page']);
} Else {
$ Page = 1;
}
$ Rs = intval ($ _ GET ['Rs ']);
If ($ rs> = 10)
{
$ Rs = 0;
$ Page ++;
}
If ($ page> 76)
{
Echo "collection completed $ {jl }";
Exit ();
}
If (! Empty ($ searchStr) // If you search
{
// Obtain the problem page
$ Content = @ file_get_contents ("http://zhidao.baidu.com/q? Ct = 17 & lm = 0 & tn = ikaslist & pn = ". ($ page-1) * 10 ). "& rn = 10 & word = ". $ word );
// Obtain the question list
Preg_match_all ("/$ uid = $ uid [1]; // Get detailed page article
$ Uid = $ uid [$ rs];
// Determine whether the data exists
$ Suid = "bd {$ uid }";
$ Sct = mysql_query ("select count (*) from {$ table_prefix} c_article where suid = '$ suid '");
$ Sct = mysql_fetch_array ($ sct );
$ Sct = $ sct [0];
If ($ sct = 0)
{
$ Content = @ file_get_contents ("http://zhidao.baidu.com/question/". $ uid. ". html ");
$ Arr = explode (' ', $ Content );
$ Art_title = $ arr [1];
$ Arr = explode (' ', $ Art_title );
$ Art_title = $ arr [0]; // The title is obtained.
// Determine whether the content meets the requirements
$ Word_arr = explode (",", $ cj_word );
$ Word_allow = false; // whether Collection is allowed during initialization
$ Word_count = count ($ word_arr); // The total number of keywords.
For ($ I = 0; $ I <$ word_count; $ I ++)
{
If (substr_count ($ art_title, $ word_arr [$ I])> 0)
{
$ Word_allow = 1;
$ I = $ word_count;
}
}
If ($ word_allow) // if conditions are met
{
$ Arr = explode ('

',$content); 
$contentQuestion=$arr[1];
$arr=explode('
', $ ContentQuestion );
$ ContentQuestion = $ arr [0];
Echo "starts to collect content
";
Echo "$ art_title
";
@ Preg_match_all ('/( | )
(. *) <\/Pre> (<\/ca> | <\/cn>)/iUs ', $ content, $ answerArr );
$ AnswerArr = $ answerArr [2];
If ($ arr_order = 1) // random sorting
{
Shuffle ($ answerArr );
}
If ($ arr_order = 2) // reverse order
{
$ AnswerArr = krsort ($ answerArr); // reverse
}
Foreach ($ answerArr as $ t)
{
$ AnswerTemp = str_replace ('
','',$t); 
$answerTemp=str_replace('
', '', $ AnswerTemp );
$ AnswerTemp = str_replace ('
','',$answerTemp); 
$answerTemp=str_replace('
', '', $ AnswerTemp );
If (strlen ($ answerTemp)> $ min_t1)
{
$ Art_content. = $ answerTemp ."
";
}
}
// Remove the link
$ S1 = "/() (. *) <\/a>/iUs ";
$ Art_content = preg_replace ($ s1, $ {2}, trim ($ art_content ));
$ Art_content = str_replace ("\ n \ r ","
", $ Art_content );
If (strlen ($ art_content)> $ min_t2)
{
$ Title_ct = mysql_query ("select count (*) from {$ table_prefix} c_article where art_title = '$ art_title'"); // check whether the title is repeated
$ Title_ct = @ mysql_fetch_array ($ title_ct );
$ Title_ct = $ title_ct [0];
If ($ title_ct> 0)
{
$ Art_title. = "{$ same_title} {$ title_ct }";
}
$ Art_time = date ("Y-m-d ");
$ Art_content = strtr ($ art_content, $ keyword );
$ SQL = "insert into {$ table_prefix} c_article (art_title, art_content, art_time, art_author, suid) values ('$ art_title', '$ art_content', '$ art_time ', '$ art_author', '$ suid') "; // Insert a collection table
Mysql_query ($ SQL );
If (empty ($ t_catx_id) // if no category exists
{
$ Sql2 = "insert into {$ t_table} ({$ t_art_title}, {$ t_art_content}, {$ t_art_time}, {$ t_artx_author}) values ('$ art_title ', '$ art_content', '$ art_time', '$ art_author ')";
} Else
{
$ Sql2 = "insert into {$ t_table} ({$ t_art_title}, {$ t_art_content}, {$ t_art_time}, {$ t_artx_author}, {$ t_catx_id }) values ('$ art_title', '$ art_content', '$ art_time', '$ art_author', '$ cat_id ')";
}
Mysql_query ($ sql2); // Insert an article table
$ Jl ++;
// The database has been processed
} Else
{
Echo "insufficient content length ";
}
// Get the content of the article.
} Else
{
Echo "the topic does not meet the requirements ";
}
} Else
{
Echo "already exists ";
} $ Rs ++;
File_put_contents ("bd.txt", "collect {$ searchStr} to article {$ page} {$ rs ");
Echo "script location. href = 'Baidu. php? SearchStr = ". urlencode ($ searchStr ). "& page = ". $ page. "& rs = ". $ rs. "& jl = ". $ jl. "'; script";
Exit ();
}
?>





Promo. you know how to ask the collection plug-in.





Collection settings unload collection View collection records collection help know collection ask collection





Ask the collection code:

The code is as follows:


Session_start ();
Header ("content-type: text/html; charset = utf-8 ");
Require ("stole_config.php ");
Require ("conn. php ");
Require ("keyword. php ");
If (! Empty ($ _ POST ['Ask '])
{
$ Ask = urlencode (trim ($ _ POST ['Ask ']); // Obtain the form submission question
$ Sp = "S". $ ask;
} Else
{
$ Sp = urlencode ($ _ GET ['sp ']);
}
If (empty ($ _ GET ['jl '])
{
$ _ GET ['jl '] = 1;
}
$ Jl = $ _ GET ['jl '];
$ Pg = intval ($ _ GET ['PG ']); // GET the page number
$ Rs = intval ($ _ GET ['Rs ']); // Obtain record parameters
If ($ rs> 9)
{
$ Rs = 0;
$ Pg ++;
}
If ($ pg> 51)
{
Echo "collection completed! Collect a total of ". urldecode ($ sp)." ". $ jl." records ";
Exit ();
}
If ($ sp) // starts with a set answer
{
$ Str = @ file_get_contents ("http://wenwen.soso.com/z/Search.e? Sp ={$ sp} & pg ={$ pg }");
@ Preg_match ("/

    (. *) <\/Ol>/iUs ", $ str, $ asklist); // Obtain the Q & A list
    // Echo $ asklist [1];
    $ Url = "/@ preg_match_all ($ url, $ asklist [1], $ urllist); // get all questions
    $ T = $ urllist [1] [$ rs];
    $ Uid = $ t;
    $ Suid = "ww {$ uid }";
    $ Sct = mysql_query ("select count (*) from {$ table_prefix} c_article where suid = '$ suid '");
    $ Sct = mysql_fetch_array ($ sct );
    $ Sct = $ sct [0];
    If ($ sct = 0)
    {
    $ Html = @ file_get_contents ("http://wenwen.soso.com/z/##t }");
    $ Html = str_replace ("
    ","",str_replace("
    "," ", $ Html ));
    $ Html = str_replace ("


    ","

    ", $ Html );
    // Echo $ html;
    @ Preg_match ("/

    . * (. *) <\/H3>/iUs ", $ html, $ ask_title );
    $ Art_title = $ ask_title [1];
    @ Preg_match ("/

    (. *) <\/P>/iUs ", $ html, $ answer );
    $ J = count ($ answer)-1;
    $ Art_content = ""; // product details
    For ($ I = $ j; $ I >=1; $ I --)
    {
    If (strlen ($ answer [$ I])> $ min_t1)
    {
    $ Art_content. = $ answer [$ I];
    }
    }
    $ Art_content = trim ($ art_content );
    $ S1 = "/() (. *) <\/a>/iUs ";
    $ Art_content = preg_replace ($ s1, $ {2}, trim ($ art_content ));
    $ Word_arr = explode (",", iconv ("gbk", "UTF-8", $ cj_word ));
    $ Word_allow = false; // whether Collection is allowed during initialization
    $ Word_count = count ($ word_arr); // total number
    For ($ I = 0; $ I <$ word_count; $ I ++)
    {
    If (substr_count ($ art_title, $ word_arr [$ I])> 0)
    {
    $ Word_allow = 1;
    $ I = $ word_count;
    }
    }
    If ($ word_allow) // if valid
    {// Start processing the database
    If (strlen ($ art_content)> $ min_t2)
    {
    Echo "adding ............................
    ";
    Echo $ art_title ."
    ";
    $ Art_title = iconv ('utf-8', 'gbk', $ art_title );
    $ Title_ct = mysql_query ("select count (*) from {$ table_prefix} c_article where art_title = '$ art_title'"); // check whether the title is repeated
    $ Title_ct = @ mysql_fetch_array ($ title_ct );
    $ Title_ct = $ title_ct [0];
    If ($ title_ct> 0)
    {
    $ Art_title. = "{$ same_title} {$ title_ct }";
    }
    $ Art_content = iconv ('utf-8', 'gbk', str_replace ("\ r \ n ","
    ", $ Art_content ));
    $ Art_content = strtr ($ art_content, $ keyword );
    $ Art_time = date ("Y-m-d ");
    $ SQL = "insert into {$ table_prefix} c_article (art_title, art_content, art_time, art_author, suid) values ('$ art_title', '$ art_content', '$ art_time ', '$ art_author', '$ suid') "; // Insert a collection table
    Mysql_query ($ SQL );
    If (empty ($ t_catx_id) // if no category exists
    {
    $ Sql2 = "insert into {$ t_table} ({$ t_art_title}, {$ t_art_content}, {$ t_art_time}, {$ t_artx_author}) values ('$ art_title ', '$ art_content', '$ art_time', '$ art_author ')";
    } Else
    {
    $ Sql2 = "insert into {$ t_table} ({$ t_art_title}, {$ t_art_content}, {$ t_art_time}, {$ t_artx_author}, {$ t_catx_id }) values ('$ art_title', '$ art_content', '$ art_time', '$ art_author', '$ cat_id ')";
    }
    Mysql_query ($ sql2); // Insert an article table
    $ Jl ++; // add 1 to the record if it is stored in the database
    // Process the database.
    } Else
    {
    Echo "not long enough ";
    }
    } Else
    {
    Echo "the topic does not meet the requirements ";
    }
    } Else
    {
    Echo "already exists ";
    }
    $ Rs ++;
    // Record the status of this collection
    $ F_tt = urldecode ($ sp). "-- page number". $ pg. "number of records". $ jl;
    File_put_contents ("ss.txt", $ f_tt );
    Echo "script location. href = 'wenwen. php? Jl = ". $ jl. "& sp = ". $ sp. "& pg = ". $ pg. "& rs = ". $ rs. "'; script";
    Exit ();
    }
    ?>





    Promo. you know how to ask the collection plug-in.





    Collection settings unload collection View collection records collection help know collection ask collection

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.