Home >Backend Development >PHP Tutorial >National People's Congress copy data processing program_Query_PHP tutorial

National People's Congress copy data processing program_Query_PHP tutorial

WBOY
WBOYOriginal
2016-07-21 16:05:35772browse

//This program is a search, currently designed to serve the article library.
//Editor: Kong Xiuxiang. Date: 2001/4/10
if(!$UploadAction):
require "config.php3";
if(!isset($table)){
//$table="artical ";
}
/*
$link_id=@MYSQL_CONNECT($hostname,$dbusername,$dbpassword) OR DIE("Cannot connect to database!");
@mysql_select_db("$dbname" ) or die("Cannot select database!");
$q="select count(id) from $table where 1 ";
$result = @mysql_query($q);
$row = @mysql_fetch_array($result);
$r_count=$row["count(artical_id)"];
*/

?>
< ;TITLE>Database Search




ACTION= "" METHOD = "POST">












This program takes time to run, so you need to wait patiently.
Query item
Article content
Article title
Article author
Journal name

Search content
Index file name
Index Title< ;/TD>

Article Category








else:

require "config.php3";
$UploadAction=0;
$added=0;
$die=0;
$single_chinese=0;
$TimeLimit=0; /*Set the timeout limit, the default time is 30 seconds and set to 0, it is unlimited*/
set_time_limit($TimeLimit );

if($data_search==""){
// Index the entire database
header("location:progsdata_index.php3");
//$msg= "The search content cannot be empty. ";
//xueroom_error_exit($msg,$PHP_SELF);
}


$link_id=@MYSQL_CONNECT($hostname,$dbusername,$dbpassword) OR DIE("Cannot connect Database! ");
@mysql_select_db("$dbname") or die("Cannot select database!");
//SELECT id,file_name,artical_author from textfile where 1 LIMIT 0, 30 
if ($table=="artical")
{
$sid="artical_id";
$stitle="artical_title";
$sauthor="artical_author";
$sdata=" artical_data";
$prog="readfile.php3";
if($a_data=="month" )
$key_where="where origin_periodical rlike '^.*$data_search.*'";
}
if($a_data=="data" )
$key_where="where $sdata rlike '^.*$data_search.*'";
if($a_data=="title" )
$key_where="where $stitle rlike '^.*$data_search.*'";
if($a_data=="author" )
$key_where="where $sauthor rlike '^. *$data_search.*'";

//$q="select $sid,$stitle,$sauthor from $table where $sdata rlike '^.*$data_search.*'order by $stitle" ;
if(($a_data=="data")&&(strlen($data_search)==2)){
$q="select $sid,$stitle,$sauthor,$sdata from $table $key_where order by $stitle";
$single_chinese=1;
}
else{
$q="select $sid,$stitle,$sauthor from $table $key_where order by $stitle ";
}
$index_data="";
$count=0;
$result =@ mysql_query($q);

if(!$result){
$msg="There are no records that meet the requirements. ";
xueroom_error_exit($msg,$PHP_SELF);
}
while($row = @mysql_fetch_array($result)) {
if(($single_chinese)&&(!myStrPos($row [$sdata],$data_search)))
continue;
else
{
$id=$row[$sid];
$title=$row[$stitle];
$author=$row[$sauthor];
if($table=="textfile")
$title=preg_replace("/.txt/","",$title);
// $data=$row["artical_data"];
//if(myStrPos($data,$data_search)) //Can be used to find a single Chinese character.
// if(strpos($data, $data_search)){ //This judgment formula is used when it is larger than one Chinese character, which is faster.
      $index_data.="$title作者:$author ";
      $count++;
  //fputs($fp, "$title作者:$author ");
// }
}
  }
@mysql_free_result($result);
mysql_close($link_id);
set_time_limit(30);
if($index_title==""){
$index_title="学而斋资料";
}
$index_title=$index_title."_".$data_search;

$html_header="$index_title";
$html_header.="
$index_title
rn";
$dte_created=date('Y-m-d H:i:s');
$html_header.="$index_describe 发现了 $count 条/查询日期:$dte_created
rn";
$html_header.="rn";
$data=$html_header.$index_data;
$data.="
";
/*If(strlen($index_file)==0){
header("Content-type: text/html");
   echo $data;
   }
   else
   {
$in_file="$index_file";
$index_file="index".$index_file;
$fp=indexfile($index_file,$index_title,$index_describe);
fputs($fp, "发现了 $count 条");
fputs($fp, "查询日期:$dte_created
rn");
fputs($fp,"
rn");
fputs($fp, $index_data);
fputs($fp, "
");
fclose($fp);
echo"点这里看新加入的文件索引
";
   }
  */
If(strlen($index_file)!=0){
     $in_file="$index_file";
     $index_file="index".$index_file;
   }
else
       $in_file="temp.html";
$fp=indexfile($index_file,$index_title,$index_describe);
fputs($fp, "发现了 $count 条");
fputs($fp, "查询日期:$dte_created
rn");
fputs($fp,"
rn");
fputs($fp, $index_data);
fputs($fp, "
");
fclose($fp);

//    echo"点这里看新加入的文件索引
";
header("location:$index_url$in_file");

    
//echo"索引文件为 $index_file";
echo"
返回 ";

endif;
?> 

www.bkjia.comtruehttp://www.bkjia.com/PHPjc/315653.htmlTechArticle? //本程序为一个搜索,目前设计服务于文章库。 //编者:孔秀祥。日期:2001/4/10 if(!$UploadAction): require config.php3; if(!isset($table)){ //$table=arti...
Statement:
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