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 :  /home/pathumthani_integration/integration/application/industry/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : //home/pathumthani_integration/integration/application/industry/industry_insert_class.php
<? session_start() ; 
header("Content-Type: text/html; charset=windows-874"); 


set_time_limit(0) ; 

include_once("../../config/config_epm.inc.php");
include_once("manage_user.inc.php");
//include("function/function.inc.php");

?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=tis-620" />
<title><?=$title_name?></title>
<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; 
} 
</script>
<style type="text/css">
<!--
A:link {
	FONT-SIZE: 12px;color: #000000;	FONT-FAMILY: Tahoma,  "Microsoft Sans Serif";TEXT-DECORATION: underline;FONT-WEIGHT: bold;
}
A:visited {
	FONT-SIZE: 12px; COLOR: #000000; FONT-FAMILY: Tahoma,  "Microsoft Sans Serif"; TEXT-DECORATION: underline;FONT-WEIGHT: bold;
}
A:active {
	FONT-SIZE: 12px; COLOR: #014d5f; FONT-FAMILY: Tahoma,  "Microsoft Sans Serif"; TEXT-DECORATION: underline;FONT-WEIGHT: bold;
}
A:hover {
	FONT-SIZE: 12px; COLOR: #f3960b; FONT-FAMILY: Tahoma,  "Microsoft Sans Serif"; TEXT-DECORATION: underline;FONT-WEIGHT: bold;
}
.style1 {color: #FF0000}
.style2 {font-size: 24px}
.h_menu {color:#FF9900}
-->
 .style_border {
 	border-bottom-width: thin; border-bottom-style: groove; border-bottom-color:#CCCCCC;
	border-right-width:thin; border-right-style:groove; border-right-color:#CCCCCC;
	border-left-width:thin; border-left-style:groove; border-left-color:#CCCCCC;
	border-top-width:thin; border-top-style:groove; border-top-color:#CCCCCC;
	}
</style>
<script language='javascript' src='js/function.js'></script>
<script language="javascript"> 

function CheckIsIE() 
{ 
if (navigator.appName.toUpperCase() == 'MICROSOFT INTERNET EXPLORER') { return true;} 
else { return false; } 
} 


function PrintThisPage() 
{ 

if (CheckIsIE() == true) 
{ 
parent.iframe1.focus(); 
parent.iframe1.print(); 
} 
else 
{ 
window.frames['iframe1'].focus(); 
window.frames['iframe1'].print(); 
} 

} 

</script> 

</head>
<body>
<? include("header.php"); ?>
<p>
  <?
		if($_POST['Submit']){
			//$letter_date = Save_date($_POST['letter_date']);		
				
				 $strSQL_2 = "SELECT
										Count(runid) AS chkCount,class_id,runid
										FROM	industry_class
										WHERE class_id='".$_POST['class_id']."'
										GROUP  BY class_id
									";
				$rsConn_2 = mysql_db_query($dbname,$strSQL_2);
				$Result_2 = mysql_fetch_assoc($rsConn_2);
				$checkRepeat=0;
				if($_GET['edit']==''){				
						if($Result_2['chkCount'] < 1){
					
						mysql_query("INSERT INTO industry_class (class_id,class_name,note)VALUES('".$_POST['class_id']."','".$_POST['class_name']."','".$_POST['note']."')");
						//mysql_query("INSERT INTO da_deprecrate (type_id,useful_life,deprecrate)VALUES('".$_POST['type_id']."','".$_POST['life_low']."','".$_POST['deprecrate_low']."')");
						//mysql_query("INSERT INTO da_deprecrate (type_id,useful_life,deprecrate)VALUES('".$_POST['type_id']."','".$_POST['life_high']."','".$_POST['deprecrate_high']."')");
						
						print"<script language='JavaScript'> alert('บันทึกข้อมูลเรียบร้อยแล้ว') </script> ";
						print"<meta http-equiv=\"refresh\" content=\"0;URL=industry_class.php\">\n";
						}
						else{
								$checkRepeat = 1;
						}					
				}
				else{
					//echo $Result_2['type_id'];
					if($Result_2['chkCount'] < 1 || $_GET['runid']==$Result_2['runid']){
						
					mysql_query("UPDATE industry_class
											SET class_id='".$_POST['class_id']."', class_name='".$_POST['class_name']."',note='".$_POST['note']."'
											WHERE runid='".$_GET['runid']."'		");					
					
					
					print"<script language='JavaScript'> alert('บันทึกข้อมูลเรียบร้อยแล้ว') </script> ";
					print"<meta http-equiv=\"refresh\" content=\"0;URL=industry_class.php\">\n";
					
					}
						else{
								$checkRepeat = 1;
						}		
				}
		}
		
		
?>
&nbsp;<img src="images/unpublish_f2.png" width="30" height="30" border="0" align="absmiddle" /><strong style="color:#000033; font-size:18px;">
		<?			
			if($_GET['edit']==''){
				echo "แบบฟอร์มเพิ่มจำพวกอุตสาหกรรม";
			}
			else{
				echo "แบบฟอร์มแก้ไขจำพวกอุตสาหกรรม";
			}
		?></strong>
</p>
<script language="JavaScript" type="text/javascript">

	function CheckForm ( form ) {
		 if ( form.class_id.value == "" ) {
		 	alert("กรุณาป้อน รหัสจำพวกอุตสาหกรรม");
			form.class_id.focus();
			return false;
		} else if ( form.class_name.value == "" ) {
			alert("กรุณาป้อน ชื่อจำพวกอุตสาหกรรม");
			form.class_name.focus();
			return false;
		} else if(document.getElementById('txt_class_id').innerHTML != ""){
			alert(" ! กรุณาระบุ รหัสจำพวกอุตสาหกรรม ให้ถูกต้อง");
			document.getElementById('txt_class_id').focus();
			return false;	
		}	
		return true;
	}		

</script>
<table width="98%" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td></td>
  </tr>
  <tr>
    <td bgcolor="#B4B4B4"><table width="100%" border="0" cellpadding="5" cellspacing="1">
      <tr>
        <td bgcolor="#FFFFFF">
        <form id="form1" name="form1" method="post" action="" onsubmit="return CheckForm(this)">
          <table width="100%" border="0">
            <tr>
              <td width="23%">&nbsp;</td>
              <td width="67%" class="style1">
			  		<?
						if($checkRepeat == 1){
							echo "*** รหัสจำพวกอุตสาหกรรมซ้ำ กรุณาตรวจสอบ";
						}
					?>
			    </td>
              <td width="10%">&nbsp;</td>
            </tr>
          	<?
			if($_GET['edit']!=''){
				$strSQL_3 = "SELECT *	FROM industry_class
													";	
					if($_GET['runid'] != ''){
							$strSQL_3 .= " WHERE runid= '".$_GET['runid']."'
													";
					}
				$rsConn_3 = mysql_db_query($dbname,$strSQL_3);
				$Result_3 = mysql_fetch_assoc($rsConn_3);
			}else{
						$strSQL_class = "SELECT COUNT(runid) AS NUMCLASS	FROM industry_class	";
						$rsConn_class = mysql_db_query($dbname,$strSQL_class);
						$Result_class = mysql_fetch_assoc($rsConn_class);
						$class_id_number1=$Result_class['NUMCLASS']+1;
						
						function chkSame_1($number1){
							global $dbname,$class_id_number;
							$strP1 = "SELECT COUNT(runid) as chkNUM
													FROM	industry_class
													WHERE class_id='".$number1."'
												";
							$rsP1 = mysql_db_query($dbname,$strP1);
							$Result_P1 = mysql_fetch_assoc($rsP1);
							if($Result_P1['chkNUM']<1){
									$class_id_number=$number1;
							}else{
									$strNumber=(($number1*1)+1);
									chkSame_1($strNumber);
							}
						}
						
						chkSame_1($class_id_number1);
			}
			?>
          
            <tr>
              <td height="25" align="right"> รหัสจำพวกอุตสาหกรรม</td>
              <td><input name="class_id" disabled="disabled" type="text" id="class_id" size="10" value="<?=($_GET['edit']!='')?(($_POST['class_id']=='')?$Result_3['class_id']:$_POST['class_id']):$class_id_number?>"/><input name="class_id" type="hidden" id="class_id" size="10" value="<?=($_GET['edit']!='')?(($_POST['class_id']=='')?$Result_3['class_id']:$_POST['class_id']):$class_id_number?>"/>
              </td>
              <td>&nbsp;</td>
            </tr>
			 <tr>
              <td height="25" align="right"><span class="style1">*</span> ชื่อจำพวกอุตสาหกรรม</td>
              <td><input name="class_name" type="text" id="class_name" size="48" value="<?=($_POST['class_name']=='')?$Result_3['class_name']:$_POST['class_name']?>" />
               </td>
              <td>&nbsp;</td>
            </tr>           
            <tr>
              <td height="25" align="right"> หมายเหตุ</td>
              <td><input name="note" type="text" id="note" size="48" value="<?=($_POST['note']=='')?$Result_3['note']:$_POST['note']?>" />
               </td>
              <td>&nbsp;</td>
            </tr>
            <tr>
              <td align="right">&nbsp;</td>
              <td>
			  		<input type="submit" name="Submit" value="บันทึก" />
                  <input type="reset" name="Submit2" value="ยกเลิก" />
				  <input type="button" name="back_main" value="ย้อนกลับ"  onclick="history.back();"/>
				</td>
              <td>&nbsp;</td>
            </tr>
          </table>
        </form>
      </td>
      </tr>
    </table></td>
  </tr>
</table>
</body>
</html>

Anon7 - 2021