MINI SHELL

Server : Apache/2.2.2 (Fedora)
System : Linux App1.pathumtani.go.th 2.6.20-1.2320.fc5smp #1 SMP Tue Jun 12 19:40:16 EDT 2007 i686
User : apache ( 48)
PHP Version : 5.2.9
Disable Function : NONE
Directory :  /var/www/html/eoffice/application/document/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : /var/www/html/eoffice/application/document/docid_reg.php
<?
include("../../config/config.inc.php");
include("../../common/function.php");

// echo $sql_time."<pre>";
#$############
$com[outreset]="year";
$type="send";
#$############


if($com[outreset]=="year"){
$code_year_reset=" AND  YEAR(document.time_rec)=YEAR(now( )) "; 
}

$sql_max_case="select max(number) as maxnumber from document where type='$type' $code_year_reset AND number is not NULL ";
$query_max = mysql_query($sql_max_case)or die("Query line " . __LINE__ . " error<hr>".mysql_error());
$maxrs = mysql_fetch_assoc($query_max);


$sql_max_case="select COUNT(*) as rownumber from document where type='$type' $code_year_reset AND number is not NULL ";
$query_max = mysql_query($sql_max_case)or die("Query line " . __LINE__ . " error<hr>".mysql_error());
$rowrs = mysql_fetch_assoc($query_max);


$max_id=$maxrs[maxnumber]+1;
$now_id=$maxrs[maxnumber];
$max_row=$rowrs[rownumber];
$dif_row=$maxrs[maxnumber]-$rowrs[rownumber];

// echo "$maxrs[maxnumber]-$max_row= ".$dif_row."<br><br>";



if($dif_row=="0"){

//	echo $max_id;

}elseif($dif_row>0){
$x=$dif_row;
	for($i=$now_id;$i>0;$i--){
		$select_hole="
		select * from document where number=$i AND type='$type' $code_year_reset 
		";
		$query_max = mysql_query($select_hole)or die("Query line " . __LINE__ . " error<hr>".mysql_error());
		$num_row = mysql_num_rows($query_max);
//		echo "$i หาเจอ $num_row<br>";
		if($num_row==0){
		$hole_take[$i]=$i;
//		echo $i."<br>";
		$x--;
			if($x==0){
				break;
			}
		}
	}
}

?>

Anon7 - 2021