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/pathumthani_eoffice/application/bin/auction_news/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : /var/www/html/pathumthani_eoffice/application/bin/auction_news/addnew.php
<? 	###################################################################
	## IMMIGRATION : MAIN REDIRECT COMMAND
	###################################################################
	## Version :		20090704.001 (Created/Modified; Date.RunNumber)
	## Created Date :		2009-07-04 09:49
	## Created By :		Mr.SANIT KEAWTAWAN (KHUAN)
	## E-mail :			sanit@sapphire.co.th
	## Tel. :			087-6612010
	## Company :		Sappire Research and Development Co.,Ltd. (C)All Right Reserved
	###################################################################
	## Version :		
	## Modified Detail :		
	## Modified Date :		
	## Modified By :		
	##
	###################################################################
session_start();
include("../../common/common_system.inc.php"); 
include("../../config/config.inc.php");
include("libary/function.php"); 
$ApplicationName="zert"; 
$time_start = getmicrotime();
$type='';	
$act=$_GET[action];
$post_by=trim($_SESSION[session_staffname]." ". $_SESSION[session_staffsurname]);
//  select staff
$idx=$_SESSION[session_staffid];
$sqlstaff="SELECT org_staffgroup.groupname,epm_staff.staffname,epm_staff.staffsurname,
epm_staff.email,epm_staff.telno
FROM org_groupmember Inner Join epm_staff ON epm_staff.staffid = org_groupmember.staffid
Inner Join org_staffgroup ON org_groupmember.gid = org_staffgroup.gid  WHERE epm_staff.staffid='$idx'";

$resultstaff=mysql_query($sqlstaff);
$rowstaff=mysql_fetch_array($resultstaff);	
$post_mail=$rowstaff[email];
$post_tell=$rowstaff[telno];
//$post_add=$rowstaff[address];
 
    function convertDateT2E($valuedate){
        if($valuedate!=""){
        	$datearr=explode("/",$valuedate);
       	 return ($datearr[2]-543)."-".$datearr[1]."-".$datearr[0];
        }else{
        	return "0000-00-00";    
         }
    }########## END  function convertDateT2E($valuedate){
	 function randomstr ($length)
	{
		$possible = '0198765432';
		$possible.= 'abcdefghijklmnopqrstuvwxyz';
		$str=" ";
		while ( strlen ($str) <= $length)
		{
			$str .= substr ($possible, (rand() % strlen($possible)), 1);
		}
		return ($str);
	}############END  function randomstr ($length)

 if ($savedata != ""){
#    echo " <pre>xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx "; 
/*    	fileToUpload_post
fileToUpload_tor     	*/        
		$date_resive_start=convertDateT2E($date_resive_start) ;   
		$date_resive_end=convertDateT2E($date_resive_end) ;   
		$date_send_start=convertDateT2E($date_send_start) ;   
		$date_send_end=convertDateT2E($date_send_end) ;   
		$post_date=convertDateT2E($post_date) ;   

        $sql = "INSERT INTO auction SET
                            subject='".$subject."',
                            dep_id='".$gid."',
                            depname='".$depname."',                      
                            auctiontype='".$typehead."',
                            pur_doc_d1='".$date_resive_start."',
                            pur_doc_d2='".$date_resive_end."',                            
                            pur_offer_d1='".$date_send_start."',
                            pur_offer_d2='".$date_send_end."',
                            price='".$price."',
                            owner='".$session_staffid."',							
                            tell='".$tell."',
                            postdate='".$post_date."',
							stamp='".$date_stamp."'
                              ";
		  //echo "<pre>".$sql;die;
            mysql_query($sql) or die ("Line". __LINE__ . "system message : ". mysql_error());    
 			$auction_id  = mysql_insert_id() ; 
  if($_FILES){
		if($fileToUpload_post_name){
				$name_random=randomstr(16);
				$name_random=str_replace(" ",'',$name_random);
				$f_ext = getFileExtension($fileToUpload_post_name);
				$attach_name=explode(".",$fileToUpload_post_name);
				
				$namepath="$name_random.$f_ext";
				$namepath=str_replace(" ",'',$namepath);
				$foldermonth = date("Y") .   date("m")  ;
				$name="$fileToUpload_post_name";
				$save_dir = "../../upload/action/".    $foldermonth ."/" ; 
				$save_path = $save_dir .  $namepath;
				if (!(is_dir($save_dir))){ mkdir ($save_dir , "0777"); } ####### END  if (!(is_dir($save_dir)){
				if(PHP_OS=='Linux'){  chmod("$save_dir",0777);}
				if(PHP_OS=='Linux'){  chmod("$save_path",0777);}

				$sqlsave_file = $save_dir  . $namepath ; 
				$sqlins = " INSERT INTO auction_file ( id ,  name,attach,description) VALUES ( $auction_id ,  '$name','$sqlsave_file','public') "; 
				$query = mysql_query($sqlins)or die("Query line " . __LINE__ . " error<hr>".mysql_error());
				copy($fileToUpload_post,$save_path);
		} ############# END if($fileToUpload_post_name){			
		
		if($fileToUpload_tor_name){
				$name_random=randomstr(16);
				$name_random=str_replace(" ",'',$name_random);
				$f_ext = getFileExtension($fileToUpload_tor_name);
				$attach_name=explode(".",$fileToUpload_tor_name);
				
				$namepath="$name_random.$f_ext";
				$namepath=str_replace(" ",'',$namepath);
				$foldermonth = date("Y") .   date("m")  ;
				$name="$fileToUpload_tor_name";
				$save_dir = "../../upload/action/".    $foldermonth ."/" ; 
				$save_path = $save_dir .  $namepath;
				if (!(is_dir($save_dir))){ mkdir ($save_dir , "0777"); } ####### END  if (!(is_dir($save_dir)){
				if(PHP_OS=='Linux'){  chmod("$save_dir",0777);}
				if(PHP_OS=='Linux'){  chmod("$save_path",0777);}

				$sqlsave_file = $save_dir  . $namepath ; 
				$sqlins = " INSERT INTO auction_file ( id ,  name,attach,description) VALUES ( $auction_id ,  '$name','$sqlsave_file','tor') "; 
				$query = mysql_query($sqlins)or die("Query line " . __LINE__ . " error<hr>".mysql_error());
				copy($fileToUpload_tor,$save_path);
		} ############# END if($fileToUpload_tor_name){			

  }########### END   if($_FILES){

echo "<meta http-equiv=\"refresh\" content=\"0;URL=index.php\">";die; 
 } ######### END  if ($savedata != ""){
if ($updatedata != ""){ 

		$date_resive_start=convertDateT2E($date_resive_start) ;   
		$date_resive_end=convertDateT2E($date_resive_end) ;   
		$date_send_start=convertDateT2E($date_send_start) ;   
		$date_send_end=convertDateT2E($date_send_end) ;   
		$post_date=convertDateT2E($post_date) ;   		
# UPDATE auction SET subject='1',price='110000',pur_doc_d1='2009-08-18',pur_doc_d2='2009-08-25',last_update='2009-08-11 09:10:39' WHERE (id='104')  
        $sql = "UPDATE   auction SET
                            subject='".$subject."',
                            depname='".$depname."',                      
                            auctiontype='".$typehead."',
                            pur_doc_d1='".$date_resive_start."',
                            pur_doc_d2='".$date_resive_end."',                            
                            pur_offer_d1='".$date_send_start."',
                            pur_offer_d2='".$date_send_end."',
                            price='".$price."',					
                            tell='".$tell."',
                            postdate='".$post_date."'
						WHERE id=$editid 
                              ";
			$result = mysql_query($sql) ; 
 if($_FILES){
		if($fileToUpload_post_name){
				$name_random=randomstr(16);
				$name_random=str_replace(" ",'',$name_random);
				$f_ext = getFileExtension($fileToUpload_post_name);
				$attach_name=explode(".",$fileToUpload_post_name);
				
				$namepath="$name_random.$f_ext";
				$namepath=str_replace(" ",'',$namepath);
				$foldermonth = date("Y") .   date("m")  ;
				$name="$fileToUpload_post_name";
				$save_dir = "../../upload/action/".    $foldermonth ."/" ; 
				$save_path = $save_dir .  $namepath;
				if (!(is_dir($save_dir))){ mkdir ($save_dir , "0777"); } ####### END  if (!(is_dir($save_dir))
				if(PHP_OS=='Linux'){  chmod("$save_dir",0777);}
				if(PHP_OS=='Linux'){  chmod("$save_path",0777);}

				$sqlsave_file = $save_dir  . $namepath ; 
				$sqlins = " INSERT INTO auction_file ( id ,  name,attach,description) VALUES ( $editid ,  '$name','$sqlsave_file','public') "; 
				$query = mysql_query($sqlins)or die("Query line " . __LINE__ . " error<hr>".mysql_error());
				copy($fileToUpload_post,$save_path);
		} ############# END if($fileToUpload_post_name)		
		
		if($fileToUpload_tor_name){
				$name_random=randomstr(16);
				$name_random=str_replace(" ",'',$name_random);
				$f_ext = getFileExtension($fileToUpload_tor_name);
				$attach_name=explode(".",$fileToUpload_tor_name);
				
				$namepath="$name_random.$f_ext";
				$namepath=str_replace(" ",'',$namepath);
				$foldermonth = date("Y") .   date("m")  ;
				$name="$fileToUpload_tor_name";
				$save_dir = "../../upload/action/".    $foldermonth ."/" ; 
				$save_path = $save_dir .  $namepath;
				if (!(is_dir($save_dir))){ mkdir ($save_dir , "0777"); } ####### END  if (!(is_dir($save_dir))
				if(PHP_OS=='Linux'){  chmod("$save_dir",0777);}
				if(PHP_OS=='Linux'){  chmod("$save_path",0777);}

				$sqlsave_file = $save_dir  . $namepath ; 
				$sqlins = " INSERT INTO auction_file ( id ,  name,attach,description) VALUES ( $editid ,  '$name','$sqlsave_file','tor') "; 
				$query = mysql_query($sqlins)or die("Query line " . __LINE__ . " error<hr>".mysql_error());
				copy($fileToUpload_tor,$save_path);
		} ############# END if($fileToUpload_tor_name)
	}########### END   if($_FILES)
	?> <script language="javascript">alert("ปรับปรุงเรียบร้อย");</script><?
	echo "<meta http-equiv=\"refresh\" content=\"0;URL=index.php\">";die; 
} ######### END  if ($updatedata != "")

?>


<link href="libary/style.css" rel="stylesheet" type="text/css">
<link href="../../common/style.css" rel="stylesheet" type="text/css">
<style type="text/css">
<!--
.FSHOW {
	display: block;
}
.FHIDE {
	display: none;
}
.Mcurrent {
	background-color: #33FFFF;	
	border: 1px solid #666666;
}
.Mold {
	background-color: #00FF00;	
	border: 1px solid #666666;
}
.MNew {
	background-color: #FFFFFF;
	border: 1px solid #666666;
}
-->
</style>
<style type="text/css">
<!--
.style1 {font-size: 10px}
.leftbox{

}
.daterow{
	width: 520px;
}
.daterow ul{
	font-family: Verdana, Geneva, sans-serif;
	font-size: 12px;
	font-weight: bold;
	color: #900;
	text-decoration: none;
	height: 20px;
	margin: 0px;
	padding: 0px;
}
.caption{
	font-family: Verdana, Geneva, sans-serif;
	font-size: 12px;
	font-weight: bold;
	color: #900;
	text-decoration: none;
	width:180px;
	height: 20px;
	margin: 0px;
	padding: 0px;
	text-align: right;
	float: left;
	}
-->
</style>

<script type="text/javascript" src="fileupload/jquery.js"></script>
<script type="text/javascript" src="fileupload/ajaxfileupload.js"></script>
<script type="text/javascript" src="libary/popcalendar.js"></script>
<script language="javascript">
var Fstep='1';	
var FMAXstep='1';	
var FMAXcount='3';	
var act="<?=$act?>";
//if(act=="T3"){
//	FMAXcount='3';
//}
var FstepName='FORM1';	
function Input(objval){
		document.post.checkbox_use.checked=false;
		document.post.inputdate[1].checked=true;
}

 
function caldate(val1,val2,element){	
		if(val1.value!=""&&val2.value!=""){
			var arrdate1=val1.value.split("/")
			var arrdate2=val2.value.split("/")
			var date1=new Date(arrdate1[2]-543,arrdate1[1],arrdate1[0])
			var date2=new Date(arrdate2[2]-543,arrdate2[1],arrdate2[0])
			var day= Math.round((date2.getTime()-date1.getTime())/(1000 * 60 * 60 * 24))
			if(day<0){
				element.innerHTML= "กำหนดวันที่ไม่ถูต้อง";
				}else{
				element.innerHTML=(day+1)+ " วัน";	
					}			
		}
}

function chkmenu(){
	for( i=1;i<=FMAXcount;i++){
		var divby="M"+i
		var  xdiv= document.getElementById(divby)	;
		 if(xdiv){	
		 if(i<=FMAXstep){	
			 if(i==Fstep){
					xdiv.className="Mcurrent";
				}
				else{
					xdiv.className="Mold";
				}
			}else{
				xdiv.className="MNew";
			}
		}
	}

}
function checkblank(){  
		if( document.post.subject.value ==""){
			 alert("กรุณากรอกข้อมูล เรื่อง")	;
			 document.post.subject.focus()
			  return false;
		}
		
		if( document.post.date_resive_start.value ==""){
			 alert("กรุณากรอกข้อมูล วันที่ซื้อเอกสาร ")	;
			  return false;
		}		
		
		if( document.post.date_send_start.value ==""){
			 alert("กรุณากรอกข้อมูล วันที่ยื่นเอกสาร")	;
			  return false;
		}		

		if((document.post.fileToUpload_post.value =="") && (document.post.uploadfile_yn.value != "y")) {
			 alert("กรุณาเลือกไฟล์ประกาศ")	;
			  return false;
		}				
		 return true;
} ///=================== END  function checkblank(){  


function chkstep1(){
		 return true;
}
 
function callbackcalenda(date1,date2,current){
	if(date2.value==""){date2.value=current.value;}
	if(date1.value==""){date1.value=current.value;}
	if(date1.value!="" && date2.value!=""){
		   var arrdate1=date1.value.split("/")
			var arrdate2=date2.value.split("/")
			var valdate1=new Date(arrdate1[2]-543,arrdate1[1],arrdate1[0])
			var valdate2=new Date(arrdate2[2]-543,arrdate2[1],arrdate2[0])
			if(valdate1>valdate2){
			 alert("วันที่เริ่มต้นมากกว่าวันที่สิ้นสุด")	
			 if(current.name==date1.name){
				     current.value=date2.value;
				}else{
					current.value=date1.value;
				}
			}
	} ////  function callbackcalenda(date1,date2,current){
}
function SaveStep1(){
 	 var obj=document.getElementById("form1"). getElementsByTagName("INPUT")
		 var strpara="";
		 for(i=0;i<obj.length;i++){
			 if(obj.item(i).type=="checkbox"){
				  if(obj.item(i).checked){
				           strpara+="&"+obj.item(i).name+"="+ obj.item(i).value;	
				  }
				 }else{
				 strpara+="&"+obj.item(i).name+"="+ obj.item(i).value;		
				 }
			 }
	  obj=document.getElementById("form1"). getElementsByTagName("SELECT")
		 for(i=0;i<obj.length;i++){
			 if(obj.item(i).type=="checkbox"){
				  if(obj.item(i).checked){
				           strpara+="&"+obj.item(i).name+"="+ obj.item(i).value;	
				  }
				 }else{
				 strpara+="&"+obj.item(i).name+"="+ obj.item(i).value;		
				 }
			 }		
	  obj=document.getElementById("form1"). getElementsByTagName("TEXTAREA")
		 for(i=0;i<obj.length;i++){
			
				 strpara+="&"+obj.item(i).name+"="+ obj.item(i).innerHTML;		
				
			 }					 
			 
			 
	var urlsave="Process_zert.php?rndid="+Math.random()*1000+"&action=ADD&STEP=1"+strpara;
	$.get(urlsave,function(data){	
			returnval=eval("("+data+")");
			if(returnval.err==""){
				$('#hID').val(returnval.id);			
				}
			else{
				alert (returnval.err);
				}
			  });
} // END function SaveStep1(){
   
 
function DelrowDate(divid){
		if (confirm("ต้องการลบรายการนี้หรือไม่?")){
			$('#'+divid).remove();
			updatecaption();
		}
}
</script>
<body  > 

<? include("../control/headder.php");?>
<?
if ( $editid != ""){ 
	$param_edit = "?editid=$editid";

/*                            subject='".$subject."',
                            dep_id='".$gid."',
                            depname='".$depname."',                      
                            auctiontype='".$typehead."',
                            pur_doc_d1='".$date_resive_start."',
                            pur_doc_d2='".$date_resive_end."',                            
                            pur_offer_d1='".$date_send_start."',
                            pur_offer_d2='".$date_send_end."',
                            price='".$price."',
                            owner='".$session_staffid."',							
                            tell='".$tell."',
                            postdate='".$post_date."'*/
	$sql = " SELECT * FROM auction WHERE  id = '$editid'  ";
	$result = mysql_query($sql) ;
	while($rs = mysql_fetch_assoc($result)){
		$subject = $rs[subject] ; 
		$gid = $rs[dep_id] ;  $dep_id = $rs[dep_id] ; 				
		$dep_name = $rs[depname] ; 		
		$typehead = $rs[auctiontype] ; 		
		$date_resive_start = date_th2($rs[pur_doc_d1]) ; 		
		$date_resive_end = date_th2($rs[pur_doc_d2]) ; 		
		$date_send_start = date_th2($rs[pur_offer_d1]) ; 						
		$date_send_end = date_th2($rs[pur_offer_d2])  ; 		
		$date_stamp = $rs[stamp]  ; 	
		$price = $rs[price] ; 		
		$tell = $rs[tell] ; 				
		$post_date = $rs[postdate] ; 				
	} ########## END while($rs = mysql_fetch_assoc($result)){
	if ($delfileid != ""){
		$sqldel = "delete from auction_file where file_id = '$delfileid'  " ;  
		$resultdel  = mysql_query($sqldel) ; 
		echo mysql_error() ; 
		############ ยังไม่ได้มีการลบไฟล์ จริง ๆ ลบแค่ database
	} ####### END if ($delfileid != ""){
} ########## END if ( $editid != ""){ 

?>

<table width="100%" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td><? include("menu_bar.php"); ?></td>
  </tr>
  <tr>
    <td><form id="post" name="post" method="post" action="addnew.php<?=$param_edit?>" onSubmit="return Chkvalue()" enctype="multipart/form-data" >
      <table width="900" border="0" cellpadding="0" cellspacing="0">
        <tr>
          <td align="left" valign="top">&nbsp;
            <div id="lblValues"></div></td>
        </tr>
        <tr>
          <td align="left" valign="top"><table width="100%" border="0">
            <tr>
              <td width="389" bgcolor="#FFFFFF"><span class="normal_blue"><strong id="discaption"></strong></span></td>
            </tr>
          </table></td>
        </tr>
        <tr>
          <td align="left" valign="top"><table  id="form1" width="98%" border="0" align="center" cellpadding="2" cellspacing="1" bgcolor="#999999">
            <tr>
              <td colspan="6" align="center" bgcolor="#FFFFFF"><table width="99%" border="0" cellpadding="2" cellspacing="1" bgcolor="#CCCCCC" class="normal_black">
                <tr bgcolor="#f8f8f8">
                  <td height="20" colspan="2" bgcolor="#C1E2F8" >&nbsp;<img src="../../images/page.gif" width="18" height="18" border="0" align="absmiddle" />ข้อมูลพื้นฐาน<span class="blue">
                    <input name="hID" type="hidden" id="hID" value="<?=$id?>">
                    <input name="hAction" type="hidden" id="hAction" value="$status">
                  </span></td>
                </tr>
                <tr valign="top">
                  <td height="20" align="right" bgcolor="#F8F8F8">หน่วยงาน :</td>
                  <td width="733" bgcolor="#F8F8F8"><? 

				if ($editid== ""){
					$dep_name = $_SESSION['session_orgname'];
					$dep_id =$_SESSION['session_org']; 				
				}else{
					#	$dep_name = $_SESSION['session_orgname'];
					#	$dep_id =$_SESSION['session_org']; 			
				} ######## END if ($editid != ""){
				
				  if($session_apppermit[4][10]){echo "<input name=\"depname\" type=\"text\" id=\"depname\" size=\"45\"value=\"".	$dep_name."\" />
                <span class=\"redlink\">
                <input type=\"button\" name=\"button\" style='font-size:11px; width:20px; height:20px'  value=\"...\" onclick=\"MM_openBrWindow('org_select.php?type=organize','','location=yes,status=yes,scrollbars=yes,width=600,height=400')\">
                *</span>";}else{echo "<input name=\"depname\" type=\"text\" id=\"depname\" size=\"45\" value=\"".$dep_name."\" readonly=\"readonly\"/>
                <span class=\"redlink\">
                 *</span>";}?>
                    <input name="gid" type="hidden" id="gid" value="<?=$dep_id?>" />
                    <input name="gidname" type="hidden" id="gidname" value="<?=$dep_name?>" /></td>
                </tr>

                <tr valign="top">
                  <td width="123" height="9" align="right" valign="middle" bgcolor="#F8F8F8">ประเภท&nbsp;<b>:</b>&nbsp;</td>
                  <td bgcolor="#F8F8F8"> 
				  <select name="typehead"  id="typehead" class="input" style="width:200px;"      > 
                    <option value="" selected="selected" >- - กรุณาเลือก - -</option>
                    <?
					$list = mysql_query("select * from auction_type_head  ") or die("Query line " . __LINE__ . " Error<hr>".mysql_error());
					while ( $row = mysql_fetch_array($list) ) {
						$nowoption =  $row[auction_head_id]  ; 
?>					
		             	 <option value="<?=$nowoption?>"  <? if ($typehead ==$nowoption ){ echo "selected";} ?> >  <?=$row[auction_head_name]?></option>
<?						 
					}## END while ( $row = mysql_fetch_array($list) ) {
?>
                  </select>
                    <span class="redlink">*</span></td>
                </tr>
                <tr valign="top">
                  <td height="20" align="right" bgcolor="#F8F8F8">โครงการ&nbsp;<b>:</b>&nbsp;</td>
                  <td bgcolor="#F8F8F8"><input name="subject" type="text" id="subject" size="45"  value="<?=$subject?>"/>
                    <span class="redlink">*</span></td>
                </tr>
                <tr bgcolor="#FFFFFF">
                  <td height="20"  align="right">วันซื้อเอกสาร  :</td>
                  <td height="20"  align="left" ><input name="date_resive_start"  id= "date_resive_start" type="text" onFocus="blur();" size="15"  value="<?=$date_resive_start?>" readonly>
                    <input name="date2" type="button" style='font-size:11px; width:80px; height:20px' onClick="popUpCalendar(this, post.date_resive_start, 'dd/mm/yyyy','callbackcalenda(post.date_resive_start,post.date_resive_end,post.date_resive_start)')" value='เลือกวัน' >
                    <span class="redlink">*</span> ถึง
                    <input name="date_resive_end" id="date_resive_end"  type="text" onFocus="blur();" size="15"  value="<?=$date_resive_end?>" readonly>
                    <input name="date3" type="button" style='font-size:11px; width:80px; height:20px' onClick="popUpCalendar(this,post.date_resive_end, 'dd/mm/yyyy','callbackcalenda(post.date_resive_start,post.date_resive_end,post.date_resive_end)')" value='เลือกวัน' ></td>
                </tr>
                
                <tr bgcolor="#FFFFFF">
                  <td height="20"  align="right">  วันยื่นเอกสาร                    :</td>
                  <td height="20"  align="left" ><input name="date_send_start"  id="date_send_start"  type="text" onFocus="blur();" size="15"  value="<?=$date_send_start?>" readonly>
                  <input name="date" type="button" style='font-size:11px; width:80px; height:20px'
                  onClick="popUpCalendar(this, post.date_send_start, 'dd/mm/yyyy','callbackcalenda(post.date_send_start,post.date_send_end,post.date_send_start)')" value='เลือกวัน' >
                    <span class="redlink">*</span> ถึง
                    <input name="date_send_end" id="date_send_end"  type="text" onFocus="blur();" size="15"  value="<?=$date_send_end?>" readonly>
                    <input name="date" type="button"style='font-size:11px; width:80px; height:20px'
                    onClick="popUpCalendar(this,post.date_send_end, 'dd/mm/yyyy','callbackcalenda(post.date_send_start,post.date_send_end,post.date_send_end)')" value='เลือกวัน' ></td>
                </tr>
                
                <tr>
                  <td height="20" colspan="2" align="left" bgcolor="#C1E2F8">&nbsp;<img src="../../images/page.gif" align="absmiddle" />รายละเอียดของข่าว                    </td>
                </tr>
                <tr>
                  <td height="20" align="right" bgcolor="#F8F8F8">&nbsp;</td>
                  <td bgcolor="#F8F8F8"><label>
                  <?
                  if($price=="" || $price==0){
					  $echecked="checked";
					  $price="ไม่มีราคากลาง";
					  
					 }
				  ?>
                    <input type="checkbox"  id="medium_cost" name="medium_cost" value="ไม่มีราคากลาง" <?=$echecked?> onClick="checkprice()">
                    ไม่มีราคากลาง</label></td>
                </tr>
                <tr>
                  <td height="20" align="right" bgcolor="#F8F8F8">ราคากลาง&nbsp;<b>:</b>&nbsp;</td>
                  <td bgcolor="#F8F8F8"><input name="price" type="text" id="price"   size="25" value="<?= $price?>" onKeyPress="return(currencyFormat(this,',','.',event))"   onKeyUp="javaScript:if(this.value!=0){document.post.medium_cost.checked=false;}" />
                    บาท <span class="redlink">* กรอกเฉพาะตัวเลขอาราบิก ไม่ควรใส่เครื่องคอมม่า ( , )</span></td>
                </tr>
                
                <tr>
                  <td height="20" align="right" bgcolor="#F8F8F8">หมายเลขโทรศัพท์ :&nbsp;</td>
                  <td bgcolor="#F8F8F8"><input name="tell" type="text" id="tell" size="45"  value="<?=$tell?>"/></td>
                </tr>
                <tr>
                  <td height="20" align="right" bgcolor="#F8F8F8">วันที่ลงนาม :&nbsp;</td>
                  <td height="20"  align="left" bgcolor="#FFFFFF" >
                  <?
           if($post_date==""){      $post_date=date('d/m')."/". (date('Y')+543);}
		   $post_arr=explode("-",$post_date) ;
		   if($post_arr[2]>2800 && $post_arr[2] > 2700 ){ $post_date=$post_arr[2].'/'.$post_arr[1].'/'.$post_arr[0];}
				 ?>
                  <input name="post_date" type="text" id="post_date" onFocus="blur();"  value="<?=$post_date?>" size="15" readonly>
<!----------- ป้องกัน user เปลี่ยน 				  ------>			
                    <input name="date" type="button"style='font-size:11px; width:80px; height:20px' onClick="popUpCalendar(this, post.post_date, 'dd/mm/yyyy')" value='เลือกวัน' >
                    <span class="redlink">* วันที่ลงนามในเอกสารราชการ</span>
		
					</td>
                </tr>			
                <tr>
                  <td height="20" align="right" bgcolor="#F8F8F8">วันและเวลาที่บันทึก :&nbsp;</td>
                  <td height="20"  align="left" bgcolor="#FFFFFF" >
				  <?
				  if($editid){
                    	echo "$date_stamp";
					}else{
//						echo "<input name='date_stamp' type='text' style='font-size:11px; width:110px; height:20px' value='".(date(Y)).date('-m-d').date(' H:i:s')."' readonly>";
						echo (date(Y)).date('-m-d').date(' H:i:s');
					}
				?>
                    <span class="redlink">* เป็นเวลาเซิฟเวอร์ไม่สามารถแก้ไขได้ </span>
		
					</td>
                </tr>									
              </table>
                <br>
                <table width="99%" border="0" align="center" cellpadding="2" cellspacing="1" bordercolor="#eeeeee" bgcolor="#CCCCCC">
                  <tr bgcolor="#f8f8f8">
                    <td height="20" colspan="2" align="left" bgcolor="#C1E2F8" >&nbsp;<img src="../../images/email_open.gif" width="15" height="12" align="absmiddle" />&nbsp;แนบไฟล์
                      <input name="hID2" type="hidden" id="hID2" value="<?=$_GET['LastID']?>"></td>
                  </tr>
                  <tr valign="top" class="normal_black">
                    <td width="14%" height="8" align="right" bgcolor="#FCFCFC">ไฟล์ประกาศ&nbsp;<b>:</b>&nbsp;</td>
                    <td width="86%" bgcolor="#FCFCFC"><input type="file" name="fileToUpload_post" id="fileToUpload_post"  style='font-size:11px;' /> 
                      <input  style="display:none;width:100px;"name="Upload" type="button"  id="Upload" class="input" value="บันทึกการแนบไฟล์"  />
                      <span class="redlink">*</span>


<a href="<?=$fileurl?>" target='_blank' ALT="<?=$alttag?>">
<input name="uploadfile_yn" type="hidden" id="uploadfile_yn" value="x"></a>
<div id="div" style="color:#F00;font-size:12px">
                        <?=$datapost?>
                      </div></td>
                  </tr>
                  <tr valign="top" class="normal_black">
                    <td height="8" align="right" bgcolor="#FCFCFC">ไฟล์ TOR &nbsp;<b>:</b>&nbsp;</td>
                    <td bgcolor="#FCFCFC"><input type="file" name="fileToUpload_tor" id="fileToUpload_tor"  style='font-size:11px;' />
                      <div id="div2" style="color:#F00;font-size:12px">
                        <?=$datator?>
                      </div></td>
                  </tr>
                  <tr valign="top" class="normal_black">
                    <td height="8" align="right" bgcolor="#FCFCFC">&nbsp;</td>
                    <td bgcolor="#FCFCFC"> (ไฟล์แนบต้องมีขนาดไม่เกิน 2 MB) 
<? ######################--------------------------------------------------------------------- หาไฟล์แนบ
$sqlfile = " SELECT * FROM auction_file WHERE id = '$editid'   "; 
$resultx = mysql_query($sqlfile) ; 
while ($rsf= mysql_fetch_assoc($resultx)){
	$fileid = $rsf[file_id] ; 
	$filename =  $rsf[name] ; 
	$fileurl = $rsf[attach] ; 
	$filetype = $rsf[description] ; 
	if ($filetype == "public"){
		$alttag = "ไฟล์ประกาศ"; 
	}else if ($filetype == "tor"){
		$alttag = "ข้อกำหนดทางราชการ (TOR) "; 	
	}else{
		$alttag = "ไฟล์แนบ"; 	
	} ###### if ($filetype == "public"){

?>
<br>
                      <a href="<?=$fileurl?>" target='_blank' ALT="<?=$alttag?>"> <?=$filename?> </a>
					  <a href="addnew.php?editid=<?=$editid?>&delfileid=<?=$fileid?>"   ><img src='../../images_sys/b_drop.png' border="0"  >ลบไฟล์แนบ</a>
                      <script language="javascript">	document.post.uploadfile_yn.value="y" ; </script>
                      <?
} ###### END while ($rs = mysql_query($result)){
?></td>
                  </tr>
                </table>
                <br>
<?
if ( $editid != ""){ 
?>
                <input name="updatedata" type="submit" class="input" id="updatedata" style="width:1/0;" onClick=" return checkblank();" value="ปรับปรุง" />	
<?
}else{   ########## if ( $editid != ""){ 
?>		
                <input name="savedata" type="submit" class="input" id="savedata" style="width:1/0;" onClick=" return checkblank();" value="บันทึก" />
<?
} ###### END if ( $editid != ""){ 
?>				
                &nbsp;
                <input name="button" type="button" class="input" style="width:100;" onClick="window.top.location.href='dashboard.php' " value="กลับหน้าหลัก" />
                <br>
                <br></td>
            </tr>
          </table>            </td>
        </tr>
        <tr>
          <td align="left" valign="top">&nbsp;</td>
        </tr>
      </table>
    </form></td>
  </tr>
  <tr>
  <td>  </td>
  </tr>
</table>
</body>
 
<?
    $time_end = getmicrotime();
     writetime2db($timestart,$timeend);
 ?>

Anon7 - 2021