\n"; echo "$pageTitle\n"; echo ""; ?> getError(); if($err){ //echo '

1 Constructor error

' . $err . '
'; $error="Constructor error :: ".$err; ?> call('update', array('collegeCode' => $collegecode,'sysId' => $sysId)); $cv=$result; } if($client->fault){ //echo '

2 Fault call method update

'; print_r($result); echo '
'; $error="Fault call method update :: ".print_r($result); ?> getError(); //echo $err; //echo $result; //echo $fileid_want; if($err || ($result=="" && $fileid_want=="")){ //can not connect server //echo '

3 Error

' . $err . '
'; $error=$err; $a=1; $fileerror="1"; if($oFdt->countfile()=="0"){ ?> Result
' . $result . '
'; if($result=="No"){ $counttotal=0; ?> "; echo "result=".$result."
"; $names = array($collegecode, $fileid_want, 'filename1', 'filename2','path','text','detail','flagfile','sysId','updatetime','textcode','2549-11-10'); $result1 = $client->call('getfile',array('names' => $names)); if($client->fault){ echo '

Fault call method getfile

'; print_r($result); echo '
'; }else{ //check data-------------------- $text_en=$result1[5]; echo "first=
".$text_en; echo "
"; $text_en=base64_decode($text_en); echo "base64_decode1=
".$text_en; echo "
"; $text_en=gzuncompress($text_en); echo "gzuncompress1=
".$text_en; echo "
"; $text_en=base64_decode($text_en); echo "base64_decode2=
".$text_en; echo "
"; $text_en=gzuncompress($text_en); $textwrite=$text_en; echo "gzuncompres2s=
".$text_en; echo "
"; $text_en2=base64_decode($text_en); $text_en=base64_decode($text_en); $text_en=substr($text_en,26,10); $test_en=base64_encode($text_en); $text_en=md5($test_en); if($text_en==$result1[10] || (($text_en!=$result1[10]) && ($result1[7]=="3"))){ chdir($pathnow); $result1[6]=base64_decode($result1[6]); echo '

-------------------------

'; echo '

collegeCode

' . $result1[0]. '
'; echo '

fileId

' . $result1[1]. '
'; echo '

filename1

' . $result1[2]. '
'; echo '

filename2

' . $result1[3]. '
'; echo '

path

' . $result1[4]. '
'; echo '

text

' . $result1[5]. '
'; echo '

detail

' . $result1[6]. '
'; echo '

flagfile

' . $result1[7]. '
'; echo '

sysId

' . $result1[8]. '
'; echo '

updatetime

' . $result1[9]. '
'; echo "-------------------------------------
"; //set path and create folder $path="/fileupdate".$result1[4]; $pathfile=$path; $i=1; while(strrchr($pathfile,'/')!=""){ $f=strrchr($pathfile,'/'); list($p,$fo) = split('[/]',$f); $folder[$i]=$fo; //echo $folder[$i]."
"; list($pathfile,$p) = split($f,$pathfile); $i++; } for($j=1; $j<$i; $j++){ $newf[$j]=$folder[$i-$j]; //echo "newf=".$newf[$j]."
"; } //// for($k=2; $k<=$j; $k++){ $checknotfound=0; $checkfound=0; chdir($newf[$k-1]); if ($handle = opendir(getcwd())) { $checknotfound=0; while (false !== ($file = readdir($handle))) { if ($file != "." && $file != "..") { if($file==$newf[$k]){ $checkfound=1; }else{ $checknotfound=1; $save=$newf[$k]; } }else{ if($file==$newf[$k]){ $checkfound=1; }else{ $checknotfound=1; $save=$newf[$k]; } } } if($checknotfound=="1" && $checkfound!=1){ if($save==""){ }else{ mkdir($save,0775); //chmod($save,0775); } } closedir($handle); } } ///// $fileIwant=$result1[3]; echo "fileIwant=$fileIwant
"; unlink($fileIwant); //if not delete file if($result1[7]!="3"){ if (!$handle = fopen($fileIwant, 'a')) { echo "Cannot open file ($fileIwant)"; $error=1; } if (fwrite($handle, base64_decode($textwrite)) === FALSE) { echo "Cannot write to file ($fileIwant)"; $error=1; } } if($error!=1){ //echo "Success, wrote to file ($fileIwant)"; $oFd->SearchByfileId($result1[1]); if($oFd->GetRecord()=="1"){ $oFd->Delete(); } $oFd->AddNew(); $oFd->fileId=$result1[1]; $oFd->updateDate=getNowDateth(); $oFd->filename1=$result1[2]; $oFd->filename2=$result1[3]; $oFd->flagfile=$result1[7]; $oFd->flagupdate="D"; $oFd->path=$result1[4]; $oFd->detail=$result1[6]; $oFd->sysId=$result1[8]; $oFd->updatetime=$result1[9]; $oFd->flagselect="N"; $oFd->flagrestore="N"; $oFd->flaguse="N"; $oFd->Save(); $result2 = $client->call('set_to_db', array('fileId' => $result1[1],'collegeCode' => $collegecode)); if($client->fault){ $oFd->SearchByfileId($result1[1]); $oFd->GetRecord(); $oFd->Delete(); echo '

Fault call method set_to_db

'; print_r($result); echo '
'; }else{ $folderfile=getcwd(); if($result2=="Y"){ $oFdt->AddNew(); $oFdt->fileId=$result1[1]; $oFdt->Save(); chdir($pathnow); } } }else{ $oFd->SearchByfileId($result1[1]); $oFd->GetRecord(); $oFd->Delete(); } // if error ==1 }else{ $fileerror="1"; if($oFdt->countfile()=="0" || $oFdt->countfile()=="1"){ ?> "; } //if result not No } // if err method update } // if fault ?>