<?
//±¾³ÌÐoÊÇΪ½aÎoÈË´o¸´Ó¡×ÊÁϵÄÎÄÕµ½Êý¾Ý¿aרÓá£
//±aÕߣº¿×ÐaÏe¡£ÈÕÆÚ£º2001/4/10
switch($position) {
default:
session_start();
if (!isset($auth_passed)) {
echo "±¾¹¦ÄÜÖ»ÓÐÊÚȨÓû§²ÅÄÜʹÓá£";
return -1;
}
if(isset($u_name)) {
session_name($u_name);
//echo "
?>
break;
case "process":
session_start();
require "config.php3";
$UploadAction=0;
$index_path="\\index\\";
$added=0; //Ë÷ÒýÎļþÊÇñÒѾ´aeÔڵıe¼Ç¡£
$die=0; //Åoµ½Òi³£Çe¿oÍ˳oÑ»±e¼Ç¡£
$data_exist=0; //Òª¼ÓÈeµÄÎÄÕÂÒѾ´aeÔڵļÆÁ¿
$data_insert=0; //мÓÈeÎÄÕµļÆÁ¿
$repeat=0; //ÊDz»ÊÇÖظ´ÁË¡£
$TimeLimit=0; //ÉeÖó¬Ê±ÏÞÖÆʱ¼aȱʡʱ¼aΪ 30ÃeÉeÖÃΪ0ʱΪ²»ÏÞʱ
set_time_limit($TimeLimit);
//$UploadPath = AddSlashes(dirname($PATH_TRANSLATED));
$FileName = $UploadPath.$UploadFile_name; //ÉÏÔØÎļþÃu
//If(($UploadFile != "none")&&($UploadFile != ""))
If(($UploadFile =="none")||($UploadFile == "")){
$page=$PHP_SELF;
xueroom_error_exit("ÎļþÃu²»ÄÜΪ¿Õ£¬»oÕßÎļþûÓÐÉÏ´«³É¹¦¡£",$page);
}
//$file_data=file($UploadFile);
$link=@MYSQL_CONNECT($hostname,$dbusername,$dbpassword) OR DIE("²»ÄÜÁ¬½ÓÊý¾Ý¿a£¡");
@mysql_select_db("$dbname") or die("²»ÄÜÑ¡ÔñÊý¾Ý¿a£¡");
$patterne="/¡¾\sÎÄÏ׺Å\s¡¿(.+)\n/U"; //ÎÄÏ׺Å
$patternf="/¡¾ÔÎijo´¦¡¿(.+)\n/U"; //ÔÎijo´¦
$patterng="/¡¾Ô¿¯Æںš¿(.+)\n/U"; //Ô¿¯ÆÚºÅ
$patternh="/¡¾Ö\sÀa\sºÅ¡¿(.+)\n/U"; //Ö Àa ºÅ
$patternb="/¡¾¸´Ó¡Æںš¿(.+)\n/U"; //¸´Ó¡ÆÚºÅ
//$patternc="/.\s¡¾ ±e Ìa ¡¿(.+)\n¡¾.*/Us"; //±e Ìa ±¾À´²»¼Ó\n£¬µ«Åoµ½¡°Ð¡¾a(d0a1bee4)¡±ÆaÖеÄa1beÕýºÃÊÇ¡°¡¾¡±µÄÄÚÂe¡£2001/3/13
//$patternc="/¡¾ ±e Ìa ¡¿(.+)\n¡¾./Us"; //±e Ìa ±¾À´²»¼Ó\n£¬µ«Åoµ½¡°Ð¡¾a(d0a1bee4)¡±ÆaÖеÄa1beÕýºÃÊÇ¡°¡¾¡±µÄÄÚÂe¡£2001/3/13
$patternc="/¡¾\s±e\sÌa\s¡¿(.+)\n¡¾./Us"; //±e Ìa ±¾À´²»¼Ó\n£¬µ«Åoµ½¡°Ð¡¾a(d0a1bee4)¡±ÆaÖеÄa1beÕýºÃÊÇ¡°¡¾¡±µÄÄÚÂe¡£2001/3/13
$patternd="/¡¾\s×÷\sÕß\s¡¿(.+)\n/U"; //×÷ Õß
$patterna="/(.+¡¾\sÕý\sÎÄ\s¡¿)(.+)$/Us"; //ÁoÏÂÒ»¸o¡¾£¬×÷Ϊ±eÌaÀ¸µÄ½aÊø±e¼Ç¡£
$pattern11="/¡¾×÷Õß¼o½e¡¿(.+)¡¾./Us";//
$pattern12="/¡¾ÄÚÈÝÌaÒª¡¿(.+)¡¾.*/Us";//
$fp_o=fopen("$UploadFile",'r');
$data=fread($fp_o,filesize($UploadFile)); //Îļþ¶ÁÈe×Öu±aÁ¿
fclose($fp_o);
$poem_array=preg_split("/\n\s+\n\s+\n\s+/",$data);
$replacement[0]="/£¨×¢.£(C)$/s"; //Ó¦¸ÃдÉÏ¡°×¢¡±£¬ñÔo°Ñ¡°£¨ÉÏ/Ï£(C)¡±Ò²É¾ÁË¡£
$replacement[1]="/£¨×¢.£(C)\n\s/s"; //ΪÂiÇiÖeµÄһƪÎÄÕ¶øÉe¡£×¢ºo»¹Óи±Ìa¡£
//echo$poem_array[1];
$s=sizeof($poem_array);
for($i=0;$i<$s;$i++){ //¶ÔÒ»¸oÍøÒ³ÄÚµÄËuÓÐÌÆÊ«½øÐвÙ×÷¡£
//for($i=0;$i<2;$i++){ //¶ÔÒ»¸oÍøÒ³ÄÚµÄËuÓÐÌÆÊ«½øÐвÙ×÷¡£
$t_data=$poem_array[$i];
// if(preg_match($pattern,$data,$matches,PREG_SET_ORDER)){
if(preg_match($patterna,$t_data,$matchesa,PREG_SET_ORDER)){
$artical_data=$matchesa[2]; //ÕýÎÄ
$data=$matchesa[1]; //ÎÄÕÂÍ
if(preg_match($patternb,$data,$matchesb,PREG_SET_ORDER))
$date_rep=$matchesb[1]; //¸´Ó¡ÆÚºÅ
else
$date_rep="";
if(preg_match($patternc,$data,$matchesc,PREG_SET_ORDER)){
$artical_title=trim($matchesc[1]); //±eÌa
$artical_title=preg_replace($replacement,"",$artical_title);
// echo $artical_title."
";
}
else
$artical_title="";
if(preg_match($patternd,$data,$matchesd,PREG_SET_ORDER))
$artical_author=trim($matchesd[1]); //×÷Õß
else
$artical_author="";
if(preg_match($patterne,$data,$matchese,PREG_SET_ORDER)){
$resource_id=trim($matchese[1]); //ÈË´o±aºÅ
// echo $resource_id."
";
}
else
$resource_id="";
if(preg_match($patternf,$data,$matchesf,PREG_SET_ORDER))
$origin_periodical=trim($matchesf[1]); //ÆÚ¿¯
else
$origin_periodical="";
if(preg_match($patterng,$data,$matchesg,PREG_SET_ORDER))
$date_temp=$matchesg[1]; //³o°aeÈÕÆÚ
else
$date_temp="";
if(preg_match($patternh,$data,$matchesh,PREG_SET_ORDER))
$artical_type=trim($matchesh[1]); //ÎÄÕÂÖÀa
else
$artical_type="";
/
if(preg_match($pattern11,$data,$matchesd,PREG_SET_ORDER))
$author_brif=$matchesd[1]; //×÷Õß¼o½e
else
$author_brif="";
/
if(preg_match($pattern12,$data,$matches12,PREG_SET_ORDER))
$content_brif=$matches12[1]; //ÄÚÈÝÌaÒª
else
$content_brif="";
// echo$data;
//echo $artical_title;
/
echo $resource_id."
";
echo $origin_periodical."
";
echo $artical_title."
";
echo $artical_author."
";
/
// echo $date_rep."
";
if(($artical_title=="")||($resource_id=="")){
$a=$i+1;
echo "±eÌa»oÈË´o±aºÅΪ¿Õ£¬²»ºÏ¨¡£µÚ $a ƪûÓмÓÈeÊý¾Ý¿a
";
$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";
//ÔÚÈÕÆÚµÄÊý×ÖÒ»¶¨ÒªÓÐЧ£¬ñÔo±»ÖÃÁa¡£
// $date_pub=substr($date_temp,0,4)."-".substr($date_temp,4,2);
} //Èç¹uÔÎÄ¢±iÔÚ±¨Ö½ÉÏ£¬ÔoÓÐÈÕÆÚ
// $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]."
";
while($count=mysql_fetch_array($r)){ //Öظ´µÄºÅÂe¿ÉÄÜÓжa¸o£¬ÕaeÕýÖظ´µÄ²»Ò»¶¨ÊǵÚÒ»¸oÕÒµ½µÄ¡£ËuÒÔÒªÓÃÑ»*À´ÕÒ¡£2001/3/16
//ΪÁËÕÒµ½¸oÀiÓÉ£¬ÎÒ»¨µÄ´u¼Û¿ÉÊDz»Ð¡¡£
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.="
$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'Êý¾ÝдÈeʧ°Ü<br>';
}//if($result)
}//if(strlen($count)!=0){ //ÎÄÕÂÊÇ*ñÒѾ´aeÔÚ¡£
}//if(strlen($artical_title)==0){
}//if(preg_match($patterna,$t_data,$matchesa,PREG_SET_ORDER)){
}//for()
//ÏÂÃaeΪ½aÊø´¦Ài¡£
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=$indextitle."".$data_search;
$html_header="