/home/banprang/.trash/files/coremain.2/module/news_tender/news_tender_old_update_output.php


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
<?php
if(id_top_permission("news_tender")!=1){    
    
permission_fail();            
}

// Status Package Module
$status_module=select_query("status_module","cms_status_module","id","3");
if(
$status_module[0]!=1)    {    
    
fieldset_no_module();
}

if(
$p_startrow!="")                        {         $startrow=trim($p_startrow);                    }

$navig['news_tender_old']="ข้อมูลย้อนหลัง";
$navig['news_tender_old_update']="แก้ไขข้อมูลข่าวจัดซื้อจัดจ้าง (ภายในหน่วยงาน)";
navigator($navig,"startrow=$startrow");
echo
"<br>";
bar_header("แก้ไขข้อมูลข่าวจัดซื้อจัดจ้าง (ภายในหน่วยงาน)"); // Bar_Header
fieldset_top("ข่าวจัดซื้อจัดจ้าง");


if(
$p_who!="")                                {  $who=trim($p_who);                        }
if(
$p_topic!="")                            {  $topic=trim($p_topic);                    }
if(
$p_id_update!="")                         {  $id_update=trim($p_id_update);            }
if(
$p_check_files!="")                        {  $check_files=trim($p_check_files);        }
if(
$p_depart!="")                                    {  $depart=trim($p_depart);        }
if(
$p_price!="")                                    {  $price=trim($p_price);        }
if(
$p_buy!="")                                        {  $buy=trim($p_buy);            }
if(
$p_song!="")                                        {  $song=trim($p_song);            }
if(
$p_contact!="")                                    {  $contact=trim($p_contact);    }
if(
$p_who!="")                                        {  $who=trim($p_who);            }
$userfile1_name=trim($_FILES['userfile1']['name']);
if(
$p_news_out!="")                                            {  $news_out=trim($p_news_out);                }

if(
$p_date!="")                                {  $date=trim($p_date);            }
if(
$p_month!="")                            {  $month=trim($p_month);        }
if(
$p_year!="")                                {  $year=trim($p_year);            }
if(
$p_date1!="")                                {  $date1=trim($p_date1);        }
if(
$p_month1!="")                            {  $month1=trim($p_month1);        }
if(
$p_year1!="")                                {  $year1=trim($p_year1);        }
$date_post=$year.$month.$date;
$date_line=$year1.$month1.$date1;


// เช็คไฟล์ว่าถูกต้องหรือไม่
if($userfile1_name!="")            {    check_file($userfile1_name'document');    }

// Create_Filename
if($userfile1_name!="")    {    
        
$name1=create_filename($userfile1_name);        
        
$dlink="$_SESSION[folder_name]/mainfile/".$name1;
        
delete_filename("cms_news_tender","file",$id_update,"$_SESSION[folder_name]/mainfile/","id");
        
//upload_file_to_server($dlink,$_FILES['userfile1']);
        
upload_file_to_server2($dlink,$_FILES['userfile1']);
}

//*******แก้ไขข้อมูลลงในฐาน*************************************************
$sql="select file from cms_news_tender where id='$id_update'";
$result=mysql_query($sql);
$data=mysql_fetch_row($result);
        if(
$userfile1_name=="")    {        $name1=$data[0];    }

// ######## เอาไฟล์ออกจากระบบ #######
if($check_files=="1" and $userfile1_name==""){
        
check_pic_out("cms_news_tender","file",$id_update,"$_SESSION[folder_name]/mainfile/","id");
        
$name1="";
}

    
$sql="UPDATE `cms_news_tender` SET `topic` = '$topic',`depart` = '$depart',`fulltexts` = '$fulltexts',`date_post` = '$date_post',`date_line` = '$date_line',`prices` = '$price',`buy` = '$buy',`song` = '$song',`contact` = '$contact',`who` = '$who',`file` = '$name1' WHERE `id` ='$id_update'";
    
$result mysql_query($sql) or die(mysql_error());

// ####################ข่าวภายนอกหน่วยงาน ####################
include('coremain/connec_out.php');
// ชื่อไฟล์เหมือนเดิม
$sql="select file from cms_news_tender where id='$id_update' and id_tumbon='$_SESSION[id_tumbon]'";
$result=mysql_query($sql);
$data=mysql_fetch_row($result);
        if(
$userfile1_name=="")    {        $name1=$data[0];    }

// เอาชื่อไฟล์ออกจากระบบ
if($check_files=="1" and $userfile1_name==""){        $name1="";    }

// ทับชื่อไฟล์เข้าไปใหม่
if($userfile1_name!="")    {    $name1="http://$_SERVER[HTTP_HOST]/$_SESSION[web_name]/mainfile/$name1"; } 


    
$sql="UPDATE `cms_news_tender` SET `topic` = '$topic',`depart` = '$depart',`fulltexts` = '$fulltexts',`date_post` = '$date_post',`date_line` = '$date_line',`prices` = '$price',`buy` = '$buy',`song` = '$song',`contact` = '$contact',`who` = '$who',`file` = '$name1' ,`province` = '$_SESSION[name_province]',`show_on_off` = '$news_out'  WHERE id='$id_update' and id_tumbon='$_SESSION[id_tumbon]'";
    
$result mysql_query($sql) or die(mysql_error());

mysql_close($handle_out);
include(
"$_SESSION[web_name]/connect.php");
msg_update_data(); // ข้อความแก้ไขแล้ว
echo "<meta http-equiv='refresh' content='1; url=index.php?mod=news_tender_old&path=news_tender&startrow=$startrow'>" ;
fieldset_down();
?>