/home/banprang/.trash/files/coremain.1/module/news_tender/news_tender_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
<?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();
}
$navig['news_tender']="เพิ่มข่าวจัดซื้อจัดจ้าง (ภายในหน่วยงาน)";
navigator($navig);
echo
"<br>";
bar_header("เพิ่มข่าวจัดซื้อจัดจ้าง (ภายในหน่วยงาน)"); // Bar_Header
fieldset_top("ข่าวจัดซื้อจัดจ้าง");

if(
$p_id_type!="")                                    {  $id_type=trim($p_id_type);    }
if(
$p_id_sub!="")                                    {  $id_sub=trim($p_id_sub);        }

if(
$p_topic!="")                                        {  $topic=trim($p_topic);            }
if(
$p_evar!="")                                        {  $fulltexts=trim($p_evar);        }
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);        }

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);                }

$date_post=$year.$month.$date;
$date_line=$year1.$month1.$date1;

$userfile1_name=trim($_FILES['userfile1']['name']);

// เช็คไฟล์ว่าถูกต้องหรือไม่
if($userfile1_name!="")            {    check_file($userfile1_name,'document');    }
    
// Create_Filename
if($userfile1_name!="")    {    
        
$name1=create_filename($userfile1_name);        
        
$dlink="$_SESSION[web_name]/mainfile/".$name1;
        
//upload_file_to_server($dlink,$_FILES['userfile1']);
        
upload_file_to_server2($dlink,$_FILES['userfile1']);


    
$datamax1=select_max_query0("id","cms_news_tender");
    if (
$datamax1[0]=="")        {    $datamax1[0]="1";    }


//#########เพิ่มข้อมูลลงในฐาน    
        
$sql="INSERT INTO `cms_news_tender` (`id` ,`topic`,`depart` ,`fulltexts` ,`date_post` ,`date_line` ,`prices` ,
`buy` ,`song` ,`contact` ,`who`,`file` ,`status`) VALUES ('
$datamax1[0]', '$topic','$depart', '$fulltexts', '$date_post', '$date_line', '$price', '$buy', '$song', '$contact', '$main_data[name_web]', '$name1', '1')";
        
mysql_query($sql) or die(mysql_error());

// ########################ข่าวประชาสัมพันธ์ภายนอกหน่วยงาน ######################
if($p_news_out!="")                {  $news_out=trim($p_news_out);                    }


include(
'coremain/connec_out.php');
if(
$userfile1_name!="")    {    $name1="http://$_SERVER[HTTP_HOST]/$_SESSION[web_name]/mainfile/$name1"; } 


        
$sql="INSERT INTO `cms_news_tender` (`id` ,`id_tumbon`,`topic`,`depart` ,`fulltexts` ,`date_post` ,`date_line` ,`prices` ,`buy` ,`song` ,`contact` ,`who`,`file` ,`status`,`orders`,`province`,`show_on_off`) VALUES ('{$datamax1[0]}','$_SESSION[id_tumbon]', '$topic','$depart', '$fulltexts', '$date_post', '$date_line', '$price', '$buy', '$song', '$contact', '$main_data[name_web]', '$name1', '1','','$_SESSION[name_province]','$news_out')";
        
mysql_query($sql) or die(mysql_error());
        
mysql_close($handle_out);
        include(
"$_SESSION[web_name]/connect.php");


echo 
msg_insert_data();        // ข้อความแสดงการผลการเพิ่มข้อมูล
refresh_data('index.php','2');        // กลับหน้าหลัก
fieldset_down();
?>