PHP Tutorial Records search engine spider Crawl Record code
setup.php file
@ $server = $_post[' server ');
@ $sqluser = $_post[' SqlUser ');
@ $sqlpass = $_post[' Sqlpass ');
@ $sqldb = $_post[' sqldb ');
@ $adminname =$_post[' adminname ');
@ $adminpass =md5 ($_post[' adminpass ');
@ $conn = MySQL Tutorial _connect ($server, $sqluser, $sqlpass) or Die ("");
$db = mysql_select_db ($sqldb) or Die ("");
$sql 1= "Set foreign_key_checks=0";
$sql 2= "drop table if exists ' robots '";
$sql 3= "CREATE TABLE ' robots ' (
' id ' int (one) not NULL auto_increment,
' Robotsname ' varchar ($) default NULL,
' Robotsip ' varchar ($) default NULL,
' Riqi ' date default NULL,
' Shijian ' time default NULL,
' robotspage ' varchar (255) default NULL,
Primary KEY (' ID ')
) Engine=innodb default CHARSET=GBK ";
$sql 1ok=mysql_query ($sql 1, $conn);
$sql 2ok=mysql_query ($sql 2, $conn);
$sql 3ok=mysql_query ($sql 3, $conn);
if (! $sql 1ok or! $sql 2ok or! $sql 3ok) {
echo "";
} else
{
$conntext = file_get_contents ("Conn.setup");
$conntext = Str_replace ("Server", $server, $conntext);
$conntext = Str_replace ("User", $sqluser, $conntext);
$conntext = Str_replace ("Pass", $sqlpass, $conntext);
$conntext = Str_replace ("MySQLdb", $sqldb, $conntext);
$conntext = Str_replace ("Adminzh", $adminname, $conntext);
$conntext = Str_replace ("Adminmmpas", $adminpass, $conntext);
File_put_contents (".. /config.php ", $conntext);
Rename ("setup.php", "Setup.lock");
echo "";
}
?>
zz.php file
!--? php
include_once ' config.php ';
@ $ax _ym=$_server[' Request_uri ');
@ $ax _ss=$_server[' http_user_agent ');
@ $ax _url=$_server[' http_referer ');
@ $ax _ip=$_server[' remote_addr ');
@ $ax _date=date ("y-m-d");
@ $ax _time=date ("h:i:s");
$baidu =stristr ($ax _ss, "Baiduspider");
$google =stristr ($ax _ss, "Googlebot");
$soso =stristr ($ax _ss, "Sosospider");
$youdao =stristr ($ax _ss, "Youdaobot");
$bing =stristr ($ax _ss, "Bingbot");
$sogou =stristr ($ax _ss, "Sogou web Spider");
$yahoo =stristr ($ax _ss, "Yahoo! slurp");
if ($baidu)
{
$ax _ss= "Baidu";
}
ElseIf ($google)
{
$ax _ss= "Google";
}
ElseIf ($soso)
{
$ax _ss= "Soso";
}
ElseIf ($youdao)
{
$ax _ss= "Youdao";
}
ElseIf ($bing)
{
$ax _ss= "Bing";
}
ElseIf ($sogou)
{
$ax _ss= "Sogou";
}
ElseIf ($yahoo)
{
$ax _ss= "Yahoo";
}
Else
{
$ax _ss=null;
}
if ($baidu or $google or $soso or $youdao or $bing or $sogou or $yahoo)
{
$zzsql = "INSERT INTO robots (Robotsname,robotspage,robotsip,riqi,shijian) VALUES (' $ax _ss ', ' $ax _ym ', ' $ax _ip ', ' $ax _ Date ', ' $ax _time ');
$exeok =mysql_query ($zzsql, $conn);
}
?>
On the page to catch spiders Plus
include (' zz.php ')
or JS call
SOURCE download
Http://down.bKjia.c0m/down/tool/o/2011/0311/22881.html
http://www.bkjia.com/PHPjc/630759.html www.bkjia.com true http://www.bkjia.com/PHPjc/630759.html techarticle PHP tutorial Records search engine spider crawl Record Code Center form action=setup.php Method=post Table align=center tr TD Server:/tdtdinput Value=localhost Name=server//TD/TR tr td with ...