成都网站建设设计

将想法与焦点和您一起共享

php查询多个门户网站页面搜索结果简单代码

在门户网站搜索信息的功能.

平鲁网站制作公司哪家好,找创新互联!从网页设计、网站建设、微信开发、APP开发、响应式网站设计等网站项目制作,到程序开发,运营维护。创新互联自2013年起到现在10年的时间,我们拥有了丰富的建站经验和运维经验,来保证我们的工作的顺利进行。专注于网站建设就选创新互联

site.php

main.php

left.php

search.php

common/function.php

/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

site.php

全国最全最大的搜索引擎












          

                                                        

 

         

站内网页音乐铃声图片电影新闻B T论坛图书更多

 

     

   

 

 

   百度 

    Google 

    MSN中国 

   中搜 

   搜狗 

   天网 

    爱问 

   雅虎 

    一起搜 

   

                      

 

 编程词典 | 把快快搜设为首页 | 关于快快搜

Copyright © 快快搜主站 www.mrbccd.com All Rights Reserved! 吉ICP备 122345678

 

/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

left.php

$keyword =$_GET['keyword']; 

$xm=$_GET['xm'];

$keyword2=urlEncode($keyword); 

$keyword3=strtolower($keyword2); 

if($keyword =="") 

{echo "你没有输入条件啊!!"; 

exit;} 

?>

       

     

       

     

     

       

     

  

 


         
 

  

            

       

 

8 网页

 4 

百度


 4 

GOOGLE


 4 

MSN中国


 4 

中搜
 4 

搜狗
 4 

天网
 4 

爱问
 4 

雅虎
 4 

一起搜

8 音乐歌词

codego.net/tags/4/1/

8 电影

8 软件源码 

8 论坛

8 新闻

8 图片

 

 

 

/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

search.php

 

   

 

require("splitword.php");

require("common/function.php");

if($_GET){

$keyword=$_GET[keyword];

}

if($submit2!=""){ //???é???á?????é??

$h_keyword=$hide_keyword; //????????????

$keynew=$keyword;

$h_keyword.=$keyword; //????????+????

  $keyword=$h_keyword; //??×???????????keyword

}

$yuan=trim($keyword);

$tt= $yuan;

$str=gl($tt);

$sp = new SplitWord();

//·????è?????????±????·???????????·??????·

$time_start = getmicrotime();

$sp->SplitRMM($str);

$tt=$sp->SplitRMM($str);

?>

require_once("./common/db_MySQL.class.php");

$DB = new DB_MySQL; //???¨???ó

$str=array(" ",""); //?¨????????×é

$cc=str_replace($str,"",$tt); //????×?·???????????

if(substr($cc,0,2)=="??"){

$cc= substr($cc,2); //?????°?????°???±·???

}

if(substr($cc,-2,2)=="??"){

$cc= substr($cc,0,-2); //?????ó?????°???±·???

}

if(substr($cc,0,2)=="??" && substr($cc,-2,2)=="??"){

$a= substr($cc,2); //?????°?????°???±·???

$cc= substr($a,0,-2); //?????ó?????°???±·???

}

$newstr = explode("??",$cc); //????explode()??????×?·???×???????×é

if(count($newstr)==1){ //??????×é????????????1?????ò°??????????????é??

 $sql = "select * from tb_info where title like '%".$newstr[0]."%' or content like '%".$newstr[0]."%'order by id desc ";

}else{

if($submit2!=""){ //???é???á?????é??

//?????é??·???

$keynew=gl($keynew); //????±ê??·???

$sp1 = new SplitWord();

$sp1->SplitRMM($keynew);

$tc=$sp1->SplitRMM($keynew);

$cc1=dunhao($tc);

$newstr1 = explode("??",$cc1); //????explode()??????×?·???×???????×é

/***************************************************************************************/

//?????é??????·¨

$k_sql="select k_id from tb_temp";

$info = $DB->fetch_one_array($k_sql);

$kid=substr($info['k_id'],0,-1); //????×??ó?????°@?±

$k_id=explode('@',$kid); //??ID??×???????×é

$sql = "select * from tb_info "; //?é??????±í????????

while(list($name,$value)=each($k_id)){ //±é?ú??×é

   $a.="$value".",";

}

$a= substr($a,0,-1); //????×??ó?????°,?±·???

//????in???ü×??é???ù??ID????????????

$sql .= " where id in(".$a.") "; //???¨?à????????

$sql2=" and (";

for($i=0;$i

$sql0.=" title like '%".trim($newstr1[$i])."%'"." or";

}

for($j=0;$j

$sql1.=" content like '%".trim($newstr1[$j])."%'"." and";

}

$sql1=substr($sql1,0,-3); //????×??ó?????°and?±

$sql3=")";

$sql.=$sql2.$sql0.$sql1.$sql3. " order by id desc";

}

else{

//?????é???á????

for($i=0;$i

$sql0.=" title like '%".trim($newstr[$i])."%'"." or";

}

for($j=0;$j

$sql1.=" content like '%".trim($newstr[$j])."%'"." or";

}

$sql1=substr($sql1,0,-3); //????×??ó?????°or?±

$sql="select * from tb_info where".$sql0.$sql1." order by id desc";

}

}

if($_GET){

//???????á????????

$page_num = $_GET['page_num']? $_GET['page_num']: 1;

}

else{

//?×???????±,??????1

$page_num = 1;

}

//????×???????

$DB->query($sql);

$row_count_sum = $DB->get_rows();

$row_count_sum;

//??????????,???????????????ò???±?????¨??

$row_per_page = 6;

//×?????

$page_count = ceil($row_count_sum/$row_per_page);

//??????·??????????ò??×??ó????

$is_first = (1 == $page_num) ? 1 : 0;

$is_last = ($page_num == $page_count) ? 1 : 0;

//?é????????????

$start_row = ($page_num-1) * $row_per_page;

//??SQL?????í??limit×???

$sql .= " limit $start_row,$row_per_page";

//?????é??

$DB->query($sql);

$res = $DB->get_rows_array();

//?á????????

$rows_count=count($res);

$time_end = getmicrotime(); //?á?????±

$t0 = $time_end - $time_start; //???÷???±

?>

 

   

   

   

 

 ?ú?é???????ü×?????             ?ì?ì?????????à??????????  ????

 

   

 


       

for($i=0;$i<$rows_count;$i++){

$id=$res[$i]['id']; //ID??

$title=$res[$i]['title']; //±ê??

$content = $res[$i]['content']; //????

?>

     

     

       

         

       

       

         

       

     

    

           

for($k=0;$k

 $content= str_ireplace($newstr[$k],"".$newstr[$k]."",$content);

}

echo chinesesubstr($content,0,600);   

  if(strlen($content)>600){echo "...";} ?>

         

     

       

$key0.=$id.'@';

}

$key00=$key0;

 if($row_count_sum>0){

/* ???é???????ü×??????????±±í??*/

$ins="update tb_temp set k_id='".$key00."'";

$DB->query($ins);

}

/* *************************  */

  ?>

     

       

         

       

     

 

  

  if($row_count_sum>0){

  ?>

     

       

         

       

       

         

       

     

               [·???????]

  

if(!$is_first){

?>

            ?????? ??????

           

}

else{

?>

            ??????  ??????

           

}

if(!$is_last){

?>

            ?????? ×??ó????

           

}

else

{

?>

            ??????  ×??ó????

           

}

?>

  

}else{

 $z_null="    ";

 if($row_count_sum==0){echo  $z_null."±§?????????ì?÷???? ".$yuan." ?à????????????";

 echo "


";

 echo  $z_null."?ì?ì?? ?¨?é?ú??
";

 echo  $z_null."?¤ ?é??????????×???·????ó
";

 echo  $z_null."?¤ ??????????±?????×????????? '??'??'??'??'??' ??
";

}

}

?>

     

 

   

 

?ì?ì???÷ © 2008  ?????????ì?ì???ù???ú??????×??????÷???á???????ú±í?ì?ì??????±????÷???????????ò???? 

/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

main.php

$keyword =$_GET['keyword']; 

$keyword2=urlEncode($keyword); 

$xm=$_GET['xm'];

if($keyword==""){

echo "对不起,您没有输入关键字!!

点此返回

";

}

switch ($xm) {

   case  "baidu":

   $murl="http://www.baidu.com/s?wd=$keyword2";break;

   case "google":

$murl="http://www.google.com/search?hl=zh-CN&q=$keyword2";break;

   case  "msn":

       $murl="http://cnweb.search.live.com/results.aspx?q=$keyword2&go=&form=QBRE";break;

   case  "zhongsou":

 $murl="http://p.zhongsou.com/p?w=$keyword2";break;

   case  "sogou":

 $murl="http://www.sogou.com/web?query=$keyword2";break;

   case  "tianw":

 $murl="http://www.tianwang.com/cgi-bin/tw?cdtype=GB&word=$keyword2";break;

   case  "iask":

         $murl="http://www.iask.com/w?k=$keyword2&pid=33933&fromlianmeng=lianmeng";break;

   case  "yahoo":

 $murl="http://search.cn.yahoo.com/search?ei=gbk&fr=fp-tab-web-ycn&meta=vl%3Dlang_zh-CN%26vl%3Dlang_zh-TW&pid=ysearch&source=ysearch_www_hp_button&p=$keyword2";  break;

   case  "17sou":

      $murl="http://www.17so.com/so?q=$keyword2";break; 

}

?>

快快搜----<?php echo $keyword;?>

 

   

   

   

 

   

     

       

     

   

       

       

        4

       

        屏幕切换

   

/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

 function chinesesubstr($str,$start,$len) {  //$str??????,$start???????????λ???$len??????????

    $strlen=$start+$len;       //??$strlen?洢???????????????????????????λ???????????????

    for($i=0;$i<$strlen;$i++) { 

        if(ord(substr($str,$i,1))>0xa0) {      //?????????????????ASCII?????????0xa0,????????,

                                        //ord:ord() ??????????????????????? ASCII ?

            $tmpstr.=substr($str,$i,2);         //????????λ???????????$tmpstr???????????????

            $i++;    //???????1

        } 

else 

            $tmpstr.=substr($str,$i,1);   //????????????????????λ???????????$tmpstr

    } 

    return $tmpstr;      //?????????

}

/*function ExecTime(){  //?????????亯??

$time = explode(" ", microtime());

$usec = (double)$time[0]; 

$sec = (double)$time[1]; 

return $sec + $usec; 

}

*/

function getmicrotime(){ 

    list($usec, $sec) = explode(" ",microtime()); 

    return ((float)$usec + (float)$sec); 

}

function gl($tt){ //?????????

$str=array("??","");

$tt=str_replace($str,'',$tt);

$str=array("??","");

$tt=str_replace($str,'',$tt);

$str=array("!","");

$tt=str_replace($str,'',$tt);

$str=array("??","");

$tt=str_replace($str,'',$tt);

$str=array("??","");

$tt=str_replace($str,'',$tt);

$str=array(";","");

$tt=str_replace($str,'',$tt);

$str=array("??","");

$tt=str_replace($str,'',$tt);

$str=array(":","");

$tt=str_replace($str,'',$tt);

$str=array("??","");

$tt=str_replace($str,'',$tt);

$str=array("*","");

$tt=str_replace($str,'',$tt);

$str=array(".","");

$tt=str_replace($str,'',$tt);

$str=array(",","");

$tt=str_replace($str,'',$tt);

$str=array("??","");

$tt=str_replace($str,'',$tt);

$str=array("??","");

$tt=str_replace($str,'',$tt);

$str=array("??","");

$tt=str_replace($str,'',$tt);

$str=array("??","");

$tt=str_replace($str,'',$tt);

$str=array("?","");

$tt=str_replace($str,'',$tt);

$str=array("??","");

$tt=str_replace($str,'',$tt);

$str=array("'","");

$tt=str_replace($str,'',$tt);

$str=array('\\',"");

$tt=str_replace($str,'',$tt);

$str=array('/',"");

$tt=str_replace($str,'',$tt);

$str=array("(","");

$tt=str_replace($str,'',$tt);

$str=array(")","");

$tt=str_replace($str,'',$tt);

$str=array("??","");

$tt=str_replace($str,'',$tt);

$str=array("??","");

$tt=str_replace($str,'',$tt);

$str=array("_","");

$tt=str_replace($str,'',$tt);

$str=array("-","");

$tt=str_replace($str,'',$tt);

$str=array("??","");

$str=str_replace($str,'',$tt);

$str=array(" ","");

$str=str_replace($str,'',$tt);

return $str;

}

function dunhao($cc){

if(substr($cc,0,2)=="??"){

$cc= substr($cc,2); //????????????????

}

if(substr($cc,-3,2)=="??"){

$cc= substr($cc,0,-3); //????????????????

}

if(substr($cc,0,2)=="??" && substr($cc,-3,2)=="??"){

$a= substr($cc,2); //????????????????

$cc= substr($a,0,-3); //????????????????

}

return $cc;

}

function gl1($tt){ //?????????

$str=array("??","");

$tt=str_replace($str,'',$tt);

$str=array("??","");

$tt=str_replace($str,'',$tt);

$str=array("!","");

$tt=str_replace($str,'',$tt);

$str=array("??","");

$tt=str_replace($str,'',$tt);

$str=array("??","");

$tt=str_replace($str,'',$tt);

$str=array(";","");

$tt=str_replace($str,'',$tt);

$str=array("??","");

$tt=str_replace($str,'',$tt);

$str=array(":","");

$tt=str_replace($str,'',$tt);

$str=array("??","");

$tt=str_replace($str,'',$tt);

$str=array("*","");

$tt=str_replace($str,'',$tt);

$str=array(".","");

$tt=str_replace($str,'',$tt);

$str=array(",","");

$tt=str_replace($str,'',$tt);

$str=array("??","");

$tt=str_replace($str,'',$tt);

$str=array("??","");

$tt=str_replace($str,'',$tt);

$str=array("??","");

$tt=str_replace($str,'',$tt);

$str=array("??","");

$tt=str_replace($str,'',$tt);

$str=array("?","");

$tt=str_replace($str,'',$tt);

$str=array("??","");

$tt=str_replace($str,'',$tt);

$str=array("'","");

$tt=str_replace($str,'',$tt);

$str=array('\\',"");

$tt=str_replace($str,'',$tt);

$str=array('/',"");

$tt=str_replace($str,'',$tt);

$str=array("(","");

$tt=str_replace($str,'',$tt);

$str=array(")","");

$tt=str_replace($str,'',$tt);

$str=array("??","");

$tt=str_replace($str,'',$tt);

$str=array("??","");

$tt=str_replace($str,'',$tt);

$str=array("_","");

$tt=str_replace($str,'',$tt);

$str=array("-","");

$tt=str_replace($str,'',$tt);

$str=array("??","");

$str=str_replace($str,'',$tt);

return $str;

}

?>

/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////


当前标题:php查询多个门户网站页面搜索结果简单代码
分享网址:http://chengdu.cdxwcx.cn/article/gjgehg.html