您好,欢迎访问一九零五行业门户网

人大复印资料处理程序_查询篇_PHP教程

//本程序为一个搜索,目前设计服务于文章库。
//编者:孔秀祥。日期:2001/4/10
if(!$uploadaction):
require config.php3;
if(!isset($table)){
//$table=artical;
}
/*
$link_id=@mysql_connect($hostname,$dbusername,$dbpassword) or die(不能连接数据库!);
@mysql_select_db($dbname) or die(不能选择数据库!);
$q=select count(id) from $table where 1 ;
$result = @mysql_query($q);
$row = @mysql_fetch_array($result);
  $r_count=$row[count(artical_id)];
*/
?>
数据库搜索
本程序运行较费时间,需要耐心等待。
action= $php_self ?> method = post>
查询项目
文章内容
文章标题
文章作者
期刊名
搜索内容
索引文件名
索引标题
文章分类
?语言理论
历史学
中国哲学
其他
?
else:
require config.php3;
$uploadaction=0;
$added=0;
$die=0;
$single_chinese=0;
$timelimit=0; /*设置超时限制时间缺省时间为 30秒设置为0时为不限时 */
set_time_limit($timelimit);
if($data_search==){
//做全库的索引
header(location:\progs\data_index.php3);
//$msg=搜索内容不能为空。;
//xueroom_error_exit($msg,$php_self);
}
$link_id=@mysql_connect($hostname,$dbusername,$dbpassword) or die(不能连接数据库!);
@mysql_select_db($dbname) or die(不能选择数据库!);
//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=没有符合要求的记录。;
    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)) //可以用于寻找单个汉字。
//  if(strpos($data,$data_search)){  //大于一个汉字时采用本判断式,速度较快。
      $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_titlern;
$dte_created=date('y-m-d h:i:s');
$html_header.=$index_describe 发现了 $count 条/查询日期:$dte_createdrn;
$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_createdrn);
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;
?>
http://www.bkjia.com/phpjc/315653.htmlwww.bkjia.comtruehttp://www.bkjia.com/phpjc/315653.htmltecharticle? //本程序为一个搜索,目前设计服务于文章库。 //编者:孔秀祥。日期:2001/4/10 if(!$uploadaction): require config.php3; if(!isset($table)){ //$table=arti...
其它类似信息

推荐信息