|
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/requirement/application/ecomplain/ |
Upload File : |
<?
session_start();
include "../../config/config.inc.php";
include("function/function.php");
$Ticket_ID=$_POST[complain_id];
$curent_yy=$_POST[yy];
$public_writen=$_POST[public_writen];
$title=$_POST[public_title];
$public_name = $_GET[public_name];
$public_lastname = $_GET[public_lastname];
$date=$_GET[date];
$mm=$_GET[month];
$year=$_GET[year];
$public_age=$_GET[public_age];
$public_job=$_GET[public_job];
$public_address=$_GET[public_address];
$public_moo=$_GET[public_moo];
$public_tambol=$_GET[public_tambol];
$public_amphur=$_GET[public_amphur];
$public_province=$_GET[public_province];
$public_zipcode=$_GET[public_zipcode];
$public_phone=$_GET[public_phone];
$public_email=$_GET[public_email];
$public_idcard=$_GET[public_idcard];
$type_problem=$_GET[type_request];
$problem_comment=$_GET[problem_comment];
$complain_detail =$_GET[$complain_detail];
$type_request = $_GET[type_request];
$process_comment =$_GET[process_comment];
/*status_show_owner='$status_show_owner',
accept_date='$accept_date',
feedback='$feedback',
type_user='$txt_type_user',
client_ip='$user_info[client_ip]',
client_browser='$user_info[browser]',
client_browser_version='$user_info[browser_version]',
client_os='$user_info[os]',
client_os_version='$user_info[os_version]',*/
$request_level=$_GET[type_level];
//insert timeQuery
include("../../common/common_system.inc.php");
$ApplicationName="ecomplain";
$time_start = getmicrotime();
//insert timeQuery
if($type_user == "gov"){
$txt_type_user = "0"; // เจ้าหน้าที่ของรัฐ
}else{
$txt_type_user = "1";// ประชาชน
}
if($_SESSION[province_code] != ""){
$province_code = $_SESSION[province_code];
}else{
$province_code = "13000000"; // defult จังหวัดปทุม
$ran_str = randomstr(6); /// random รหัสรูปภาพ
$curent_yy = date("Y");
if($type_user != ""){
include("header_menu.php");
}
if ($_SERVER[REQUEST_METHOD] == "POST"){
if($Aaction == "SAVE"){
// วันเริ่มต้นช่วงเกิดเหต
if($rdodate == "0")
{
$act_start_date = $act_start_date0;
$act_end_date = "";
}
if($act_start_date != ""){
$arr_dt1 = explode("/",$act_start_date);
$act_sd = ($arr_dt1[2]-543)."-".$arr_dt1[1]."-".$arr_dt1[0];
}else{
$act_sd = "0000-00-00";
}
// ถึงวันที่สิ้นสุด
if($act_end_date != ""){
$arr_dt2 = explode("/",$act_end_date);
$act_ed = ($arr_dt2[2]-543)."-".$arr_dt2[1]."-".$arr_dt2[0];
}else{
$act_ed = "0000-00-00";
}
// วันที่รับเรื่อง
if($accept_date != ""){
$arr_dt3 = explode("/",$accept_date);
$act_ad = ($arr_dt3[2]-543)."-".$arr_dt3[1]."-".$arr_dt3[0];
}else{
$act_ad = "0000-00-00";
}
## รหัส Ticket ID ที่จะบันทึกเข้าสู่ระบบ
$Tic_TYY = substr((date("Y")+543),-2);
$Ticket_ID = $Tic_TYY.date("md")."T".date("His");
// echo"<pre>";print_r($_POST);die;
//------------------------------------------------------------- บันทึกข้อมูลติดตามความต้องการ
####### USER INFOMATION
$info=$_SERVER['HTTP_USER_AGENT'];
$info=str_replace("(","",$info);
$info=str_replace(")","",$info);
$arr_info=explode(" ",$info);
$user_info[client_ip]=$REMOTE_ADDR;
$user_info[browser].=$arr_info[0];
$user_info[browser]=$arr_info[2];
$user_info[browser_version]=str_replace(";","",$arr_info[3]);
$user_info[os]=$arr_info[4]." ".$arr_info[5];
$user_info[os_version]=$arr_info[6];
$sql_insert = "
INSERT INTO
tbl_complain set
complain_id='$Ticket_ID',
yy='$curent_yy',
public_writen = '$public_writen',
public_title='$title',
public_name = '$public_name',
public_lastname = '$public_lastname',
date='$date',
month='$mm',
year='$year',
public_age = '$public_age',
public_job = '$public_job',
public_address = '$public_address',
public_moo = '$public_moo',
public_tambol = '$public_tambol',
public_amphur = '$public_amphur',
public_province = '$public_province',
public_zipcode = '$public_zipcode',
public_phone = '$public_phone',
public_email = '$public_email',
public_idcard='$public_idcard',
type_request = '$type_problem',
problem_comment = '$problem_comment',
complain_detail = '$complain_detail',
type_request = '$type_request',
process_comment = '$process_comment',
keyin_time = now(),
status_show_owner='$status_show_owner',
accept_date='$accept_date',
feedback='$feedback',
type_user='$txt_type_user',
client_ip='$user_info[client_ip]',
client_browser='$user_info[browser]',
client_browser_version='$user_info[browser_version]',
client_os='$user_info[os]',
client_os_version='$user_info[os_version]',
request_level='$type_level' ";
// echo '<pre>'.$sql_insert;die;
$result_insert = mysql_db_query($dbname,$sql_insert);
$insert_id = $Ticket_ID; // รหัสล่าสุดที่มีการเพิ่มข้อมูล
// กรณี เจ้าหน้าที่ login เข้ามากรอกข้อมูล
//$sql_insert_gov = "INSERT INTO tbl_complain_approve SET complain_id='$insert_id', org_code='$org_code',subject='$complain_detail',type_problem='$type_problem',office_id='$office_id',ministry='$ministry',department='$department',accept_date='$txt_date_accept' ";
// end กรณีเจ้าหน้าที่ login เข้ามากรอก
$count_file = count($file_act);// นับจำนวนไฟล์ที่แนบเข้ามา
for($i = 0; $i < $count_file; $i++){ // ทำการวน loop เพื่อบันทึกไฟล์แนบ
if(!empty($file_act[$i])){
$yymmdd = (date("Ymd")).$insert_id."_".randigit(5);
$path_name = "../../attach_file/";
$arrfileext = explode("." , $file_act_name[$i]) ;
$nmcount = count($arrfileext) - 1 ;
$file1ext = $arrfileext[$nmcount] ;
$server_filename = $yymmdd.".$file1ext" ;
$save_path = $path_name.$server_filename;
if (copy( $file_act[$i] , $save_path )){
$sql_insert_file = "INSERT INTO tbl_attachfile SET complain_id='$insert_id',act_file='$save_path',note_file='$note_file[$i]'";
$result_insert_file = mysql_db_query($dbname,$sql_insert_file);
}// end if (copy( $url_file , $save_path )){
} // end if(!empty($file_act[$i])){
}// end for(){
if($result_insert){
if($type_user != ""){
addlog("บันทึกเรื่องเรียน - ร้องทุกข์ โดยเจ้าหน้าที่",$app_id,$act1,$insert_id); // add log
echo "
<script language=\"javascript\">
alert(\"ทำการบันทึกข้อมูลเสร็จสิ้น ! ท่านจะได้ Ticket_ID เพื่อตรวจสอบสถานะความต้องการจากระบบ\\n \");
location.href='form_manage_data.php?senttab=$senttab&action=Ticket_ID&complain_id=$insert_id&type_user=$type_user';
</script>
";
exit();
}else{
addlog("บันทึกเรื่องเรียน - ร้องทุกข์โดยประชาชน",$app_id,$act1,$insert_id); // add log
echo "
<script language=\"javascript\">
alert(\"ทำการบันทึกข้อมูลเสร็จสิ้น ! ท่านจะได้ Ticket_ID เพื่อตรวจสอบสถานะความต้องการจากระบบ\\n \");
location.href='form_manage_data.php?action=Ticket_ID&complain_id=$insert_id&type_user=$type_user';
</script>
";
exit();
} // end if($type_user != ""){
}// end if($result_insert){
} // end if($Aaction == "SAVE"){
// แก้ไขรายการข้อมูล
if($Aaction == "SAVE_EDIT"){
if($rdodate == "0")
{
$act_start_date = $act_start_date0;
$act_end_date = "";
}
if($act_start_date != ""){
$arr_dt1 = explode("/",$act_start_date);
$act_sd = ($arr_dt1[2]-543)."-".$arr_dt1[1]."-".$arr_dt1[0];
}else{
$act_sd = "0000-00-00";
}
// ถึงวันที่สิ้นสุด
if($act_end_date != ""){
$arr_dt2 = explode("/",$act_end_date);
$act_ed = ($arr_dt2[2]-543)."-".$arr_dt2[1]."-".$arr_dt2[0];
}else{
$act_ed = "0000-00-00";
}
// วันที่รับเรื่อง
if($accept_date != ""){
$arr_dt3 = explode("/",$accept_date);
$act_ad = ($arr_dt3[2]-543)."-".$arr_dt3[1]."-".$arr_dt3[0];
}else{
$act_ad = "0000-00-00";
}
$sql_update = "
UPDATE tbl_complain SET
public_writen = '$public_writen',
public_title='$title',
public_name = '$public_name',
public_lastname = '$public_lastname',
date='$date',
month='$mm',
year='$year',
public_job = '$public_job',
public_address = '$public_address',
public_moo = '$public_moo',
public_tambol = '$public_tambol',
public_amphur = '$public_amphur',
public_province = '$public_province',
public_zipcode = '$public_zipcode',
public_phone = '$public_phone',
public_email = '$public_email',
type_problem = '$type_problem',
problem_comment = '$problem_comment',
complain_detail = '$complain_detail',
type_request = '$type_request',
feedback='$feedback',
process_comment = '$process_comment',
type_user='$txt_type_user'
WHERE complain_id='$insert_id'";
//echo "<pre>".$sql_update;die;
$result_update = mysql_db_query($dbname,$sql_update);
$count_file = count($file_act);// นับจำนวนไฟล์ที่แนบเข้ามา
for($i = 0; $i < $count_file; $i++){ // ทำการวน loop เพื่อบันทึกไฟล์แนบ
if(!empty($file_act[$i])){
$yymmdd = (date("Ymd")).$insert_id."_".randigit(5);
$path_name = "../../attach_file/";
$arrfileext = explode("." , $file_act_name[$i]) ;
$nmcount = count($arrfileext) - 1 ;
$file1ext = $arrfileext[$nmcount] ;
$server_filename = $yymmdd.".$file1ext" ;
$save_path = $path_name.$server_filename;
if (copy( $file_act[$i] , $save_path )){
$sql_insert_file = "INSERT INTO tbl_attachfile SET complain_id='$insert_id',act_file='$save_path',note_file='$note_file[$i]'";
$result_insert_file = mysql_db_query($dbname,$sql_insert_file);
}// end if (copy( $url_file , $save_path )){
} // end if(!empty($file_act[$i])){
}// end for(){
if($result_update){
if($type_user != ""){
addlog("แก้ไขเรื่องเรียน - ร้องทุกข์ โดยเจ้าหน้าที่",$app_id,$act1,$insert_id); // add log
echo "
<script language=\"javascript\">
alert(\"ทำการบันทึกข้อมูลเสร็จสิ้น ! ท่านจะได้ Ticket_ID เพื่อตรวจสอบสถานะความต้องการจากระบบ\\n \");
location.href='form_manage_data.php?senttab=$senttab&action=Ticket_ID&complain_id=$insert_id&type_user=$type_user';
</script>
";
//location.href='report_index.php?senttab=$senttab';
exit();
}else{
addlog("แก้ไขเรื่องเรียน - ร้องทุกข์ โดยประชาชน",$app_id,$act1,$insert_id); // add log
echo "
<script language=\"javascript\">
alert(\"ทำการบันทึกข้อมูลเสร็จสิ้น ! ท่านจะได้ Ticket_ID เพื่อตรวจสอบสถานะความต้องการจากระบบ\\n \");
location.href='form_manage_data.php?action=Ticket_ID&complain_id=$insert_id&type_user=$type_user';
</script>
";
exit();
}// end if($type_user != ""){<strong></strong>
}// end if($result_update){
}
//end post
}
}
?>