[摘要](resource_id=="")) a=i+1; echo "标题或人大编号为空,不合法。第 a 篇没有加入数据库<...
($resource_id=="")){
$a=$i+1;
echo "标题或人大编号为空,不合法。第 $a 篇没有加入数据库<BR>";
$die=1;
//break;
}
else{
if(strlen(trim(substr($date_temp,6,2)))!=0){
$date_pub=substr($date_temp,0,4)."-".substr($date_temp,4,2).substr($date_temp,6,2)." 00:00:00";
}
else{
$date_pub=substr($date_temp,0,4)."-".substr($date_temp,4,2)."-01 01:01:01";
//在日期的数字一定要有效,否则被置零。
// $date_pub=substr($date_temp,0,4)."-".substr($date_temp,4,2);
} //如果原文发表在报纸上,则有日期
// $artical_title=preg_replace($pattern91,"",$artical_title);
$origin_periodical=addslashes($origin_periodical);
$artical_title=addslashes($artical_title);
$date_reprinted=substr($date_rep,0,4)."-".substr($date_rep,4,2)."-01 01:01:01";
if($content_brif)
$artical_data="$content_brif \r\n $artical_data";
$artical_data=addslashes($artical_data);
$artical__size=strlen($artical_data);
$resource_id=trim($resource_id);
$query = "INSERT INTO artical (resource_id, origin_periodical,date_pub, artical_author, artical_title, artical_data, artical_type,artical__size, date_reprinted,catalog) VALUES ('$resource_id', '$origin_periodical','$date_pub', '$artical_author', '$artical_title', '$artical_data', '$artical_type','$artical__size', '$date_reprinted',$catalog)";
$q="select artical_id,resource_id,artical_title,artical_author,artical_type from artical where resource_id=\"$resource_id\"";
$r = @mysql_query($q);
// $count=@mysql_fetch_row($r);
// echo "$artical_type,,".$count[4]."<BR>";
while($count=mysql_fetch_array($r)){ //重复的号码可能有多个,真正重复的不一定是第一个找到的。所以要用循环来找。2001/3/16
//为了找到个理由,我花的代价可是不小。
if($artical_type==$count[4]&&$artical_author==$count[3]){
$data_exist+=1;
$id=$count[0];
$title=$count[2];
$author=$count[3];
$repeat=1;
break;
}
}
if($repeat){
$f_data.="<TR><TD><a href=".$dataurl."readfile.php3?artical_id=$id>$title</a><TD>作者:$author </TR>\r\n";
$repeat=0;
}
else{
$result = @mysql_query($query);
if($result){
$data_insert+=1;
$id= mysql_insert_id();
$f_data.="<TR><TD><a href=".$dataurl."readfile.php3?artical_id=$id>$artical_title</a><TD>作者:$artical_author</TR>\r\n";
}
else{
echo $data;
echo'数据写入失败<br>';
}//if($result)
}//if(strlen($count)!=0){ //文章是否已经存在。
}//if(strlen($artical_title)==0){
}//if(preg_match($patterna,$t_data,$matchesa,PREG_SET_ORDER)){
}//for()
//下面为结束处理。
set_time_limit(30);
mysql_close($link);
$dte_created=date('Y-m-d H:i:s');
$total=$data_exist+$data_insert;
if($index_title==""){
$index_title="学而斋资料";
}
$index_title=$index_title."_".$data_search;
$html_header="<html><head><title>$index_title</title></head><body>";
$html_header.="<h5>$index_title</h5>\r\n";
$dte_created=date('Y-m-d H:i:s');
$html_header.="<font color='Maroon' face='楷体' size=1>$index_describe 发现了 $total 条/上载日期:$dte_created</font><hr>\r\n";
$html_header.="<table>\r\n";
$data=$html_header.$f_data;
$data.="<TABLE></body></html>";
/*
If(strlen($index_file)==0){
header("Content-type: text/html");
echo $data;
}
else
{
*/
If(strlen($index_file)!=0){
$in_file="$index_file";
$index_file=$index_path.$in_file;
}
else
$in_file="temp.html";
$fp=indexfile($index_file,$index_title,$index_describe);
fputs($fp, "发现了 $total 条");
fputs($fp, "查询日期:$dte_created</font><hr>\r\n");
fputs($fp,"<table>\r\n");
fputs($fp, $f_data);
fputs($fp, "<TABLE></body></html>");
fclose($fp);
echo "<HTML><HEAD><TITLE>文件提取</TITLE></HEAD><BODY>";
if($added){ //如果索引文件存在。$added是一个全局变量。
echo "索引文件".$in_file."已经存在,新索引已经加入到文件的最后。<BR>";
// echo "请看<a href=$index_url$in_file>".$in_file.'</a>的最后'.$total.'条。<BR>';
}
else{
//将新索引文件写入总索引文件。
$total_index=$index_path."k_index.html";
$fp_i=fopen($total_index,'a+');
$file_link="<a href=$index_url$in_file>$index_describe</a><BR>\r\n";
fputs($fp_i, $file_link);
fclose($fp_i);
}//if($added)
echo"点<a href=$index_url$in_file>这里</a>看新加入的文件索引<BR>";
//}//If(strlen($index_file)==0){
if($data_exist>0)
echo "重复的文章共".$data_exist."篇。<BR>";
if($data_insert>0)
echo "新加入的文章共".$data_insert."篇。<HR>";
$total=$data_exist+$data_insert;
echo"上传文件".$UploadFile_name."共有文章".$total."篇。";
echo"<BR><A HREF = $PHP_SELF>返回 </A>";
echo"</BODY></HTML>";
break;
}
?>
关键词:人大复印资料处理程序_输入篇