Home > Backend Development > PHP Tutorial > PHP knows and asks the collection plug-in code_PHP tutorial

PHP knows and asks the collection plug-in code_PHP tutorial

WBOY
Release: 2016-07-21 15:33:50
Original
756 people have browsed it

Recently I have discovered that there are more and more versions of Know and Ask the Thief! !
I saw a Baidu thief’s website and it also reached pr6. More than 100,000 collected! !
After forty days of practice on Jianlila, I found that Baidu is indeed very friendly to this.
Judging from website visits, many of them are also searched from Baidu!
So it is still feasible to fill the website content with know and ask.
So I developed a collection plug-in for knowing questions
In principle, it is suitable for php+mysql and the article is in a table program
I know the collection code

Copy 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 search keywords
$word="";//Set keywords to empty
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 search
{
//Get the question page
$content=@file_get_contents("http://zhidao.baidu.com/q ?ct=17&lm=0&tn=ikaslist&pn=".(($page-1)*10)."&rn=10&word=".$word);
//Get the question list
preg_match_all("/< a href="/question/(.*).html/iUs",$content,$uid);
$uid=$uid[1];//Get detailed page articles
$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];//End of getting title
//Determine whether the content conforms to
$word_arr=explode(",",$cj_word);
$word_allow=false;//Whether initialization allows collection
$word_count=count($word_arr);/ /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 the conditions are met
{
$arr= explode('
',$content); <br>$contentQuestion=$arr[1]; <br>$arr=explode('
', $contentQuestion);
$contentQuestion=$arr[0];
echo "Start collecting content
";
echo "$art_title
";
@preg_match_all('/ (|)
(.*)
(
|)/iUs',$content,$answerArr);
$answerArr=$answerArr[2];
if($arr_order==1)//Randomly sort
{
shuffle($answerArr);
}
if($arr_order= =2)//Reverse order
{
$answerArr=krsort($answerArr);//Reverse order
}
foreach($answerArr as $t)
{
$answerTemp= str_replace('
','',$t); <br>$answerTemp=str_replace('
','',$answerTemp); <br>$answerTemp=str_replace('
','',$answerTemp); <br>$answerTemp=str_replace('
','',$answerTemp );
if(strlen($answerTemp)>$min_t1)
{
$art_content .=$answerTemp."
";
}
}
/ /Remove link
$s1="/()(.*)/iUs";
$art_content=preg_replace($s1,${2},trim ($art_content));
$art_content=str_replace("nr","
",$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 into the collection table
mysql_query($sql);
if(empty($t_catx_id ))//If there is no classification
{
$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 article table
$jl++;
//Database processing completed
}else
{
echo "The content length is not enough";
}
//End of getting article content
}else
{
echo "Theme does not meet the requirements";
}
}else
{
echo "Already exists ";
}$rs++;
file_put_contents("bd.txt","Collect {$searchStr} to item {$rs} on {$page}");
echo "<script> location.href='baidu.php?searchStr=".urlencode($searchStr)."&page=".$page."&rs=".$rs."&jl=".$jl." ';</script&gt ;"; <BR>exit(); <BR>}<BR>?> <br><link href="style.css" rel="stylesheet" type="text/css" /> <br><table width="700" border="0" align="center" cellspacing="1" bgcolor="#CCCCCC"> <br><tr> <br><td height="50" align="center" bgcolor="#00CC00">&lt ;h1><a href="http://www.jianlila.com">Recommended Gifts</a>Know Ask Collection Plug-in</h1></td> <br></ tr> <br></table> <br><table width="700" border="0" align="center" cellspacing="1" bgcolor="#CCCCCC" style="margin-top:6px ; margin-bottom:6px;"> <br><tr> <br><td height="30" align="center" bgcolor="#FFFFFF"><a href="cj_config.php ">Collection settings</a> <a href="uninstall.php" onclick="return confirm('Are you sure you want to uninstall the collection plug-in');">Uninstall collection</a> <a href="cj_view.php">View collection records</a> <a href="cj_help.php">Collection help</a> <a href="baidu.php" target="_blank ">Know the collection</a> <a href="wenwen.php" target="_blank">Ask the collection</a></td> <br></tr> <br></table> <br><table width="537" height="45" align="center" style="margin-top:30px;"><tr><td height="39 "> <br><form id="form1" name="form1" method="get" action="baidu.php"> <br><div id="search"> <br>&lt ;input name="searchStr" type="text" id="searchStr" value="<?php echo $searchStr; ?>" size="60" /> <br><input type="submit " name="searchBtn" id="searchBtn" value="Know secretly" style="height:25px; line-height:25px;" /> <br></div> <br></form> <br></td></tr></table> <br> </div> <br>Ask about the collection code: <br><div class="codetitle"> <span style="CURSOR: pointer" onclick="doCopy('code89459')"><u>Copy code</u></span> The code is as follows: </div> <div class="codebody" id="code89459"> <br><?php <BR>session_start(); <BR>header("content-type:text/html;charset=utf-8"); <BR>require("stole_config.php") ; <BR>require("conn.php"); <BR>require("keyword.php"); <BR>if(!empty($_POST['ask'])) <BR>{ <BR>$ ask=urlencode(trim($_POST['ask']));//Get the question submitted by the form <BR>$sp="S".$ask; <BR>}else <BR>{ <BR>$sp =urlencode($_GET['sp']); <BR>} <BR>if(empty($_GET['jl'])) <BR>{ <BR>$_GET['jl']=1; <BR>} <BR>$jl=$_GET['jl']; <BR>$pg=intval($_GET['pg']);//Get the number of pages<BR>$rs=intval($_GET[ 'rs']);//Get the recorded parameters <BR>if($rs>9) <br>{ <br>$rs=0; <br>$pg++; <br>} <br>if($ pg>51) <br>{ <br>echo "Collection completed!Collect a total of ".urldecode($sp)." ".$jl." records"; <br>exit(); <br>} <br>if($sp)//Start only after setting the answer<br>{ <br>$str=@file_get_contents("http://wenwen.soso.com/z/Search.e?sp={$sp}&pg={$pg}"); <br>@preg_match(" /<ol class="result_list">(.*)</ol>/iUs",$str,$asklist);//Get the question and answer list<br>//echo $asklist[1]; <br>$url="/<a target="_blank" href="/z/(q.*.htm)/iUs"; <br>@preg_match_all($url,$asklist[1],$urllist); //Get all questions <br>$t=$urllist[1][$rs]; <br>$uid=$t; <br>$suid="ww{$uid}"; <br>$sct =mysql_query("select count(*) from {$table_prefix}c_article where suid='$suid' "); <br>$sct=mysql_fetch_array($sct); <br>$sct=$sct[0]; <br>if($sct==0) <br>{ <br>$html=@file_get_contents("http://wenwen.soso.com/z/${t}"); <br>$html=str_replace ("<pre class="brush:php;toolbar:false">&quot;,&quot;&quot;,str_replace(&quot;</pre>","",$html)); <br>$html=str_replace("<br/><br/> <br/>","<br/><br/>",$html); <br>//echo $html; <br>@preg_match("/<div class=" question_main">.*<h3>(.*)</h3>/iUs",$html,$ask_title); <br>$art_title=$ask_title[1]; <br>@preg_match("/ <div class="answer_con">(.*)</div>/iUs",$html,$answer); <br>$j=count($answer)-1; <br>$art_content= "";//Product details<br>for($i=$j;$i>=1;$i--) <br>{ <br>if(strlen($answer[$i])>$ min_t1) <br>{ <br>$art_content .= $answer[$i]; <br>} <br>} <br>$art_content=trim($art_content); <br>$s1="/(&lt ;a .*>)(.*)</a>/iUs"; <br>$art_content=preg_replace($s1,${2},trim($art_content)); <br>$word_arr=explode (",",iconv("gbk","utf-8",$cj_word)); <br>$word_allow=false;//Whether initialization allows collection<br>$word_count=count($word_arr);// Total number<br>for($i=0;$i<$word_count;$i++) <BR>{ <BR>if(substr_count($art_title,$word_arr[$i])>0) <br>{ <br>$word_allow=1; <br>$i=$word_count; <br>} <br>} <br>if($word_allow)//If legal<br>{ //Start processing the database<br>if( strlen($art_content)>$min_t2) <br>{ <br>echo "<font color=red>Adding...................... ......</font><br>"; <br>echo $art_title."<br>"; <br>$art_title=iconv('utf-8','gbk', $ art_title); <br>$title_ct=mysql_query("select count(*) from {$table_prefix}c_article where art_title ='$art_title' ");//Check whether the title is duplicated<br>$title_ct=@mysql_fetch_array($title_ct ); <br>$title_ct=$title_ct[0]; <br>if($title_ct>0) <br>{ <br>$art_title .="{$same_title}{$title_ct}"; <br>} <br>$art_content=iconv('utf-8','gbk',str_replace("rn","<br>",$art_content)); <br>$art_content=strtr($art_content,$keyword) ; <br>$art_time=date("Y-m-d"); <br>$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 into the collection table<br>mysql_query($sql); <br>if(empty($t_catx_id))//If no classification<br>{ <br>$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')"; <br>}else <br>{ <br>$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')"; <br>} <br>mysql_query($sql2); //Insert article table<br>$jl++;//If stored in the database, add 1 to the record <br>//End of database processing<br>}else <br>{ <br>echo "Not long enough"; <br> } <br>}else <br>{ <br>echo "Theme does not meet the requirements"; <br>} <br>}else <br>{ <br>echo "already exists"; <br>} <br> $rs++; <br>//Record the status of this collection<br>$f_tt= urldecode($sp)."--number of pages".$pg."Number of records".$jl; <br>file_put_contents( "ss.txt",$f_tt); <br>echo "<script>location.href='wenwen.php?jl=".$jl."&sp=".$sp."&pg=".$pg ."&rs=".$rs." ';</script>";
exit();
}
?>





< ;h1>Recommended GiftsKnow Ask Collection Plug-in





Collection settings Uninstall collection View collection records Collection help Know the collection Ask the collection








< ;/form>

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/322561.htmlTechArticleRecently I have found that there are more and more versions of Know and Ask the Thief! ! I have seen a Baidu thief website that also reached PR6. More than 100,000 collected! ! After forty days of practice with Jianlila...
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template