/home/banprang/domains/plai.go.th/public_html/coremain/module/project/project_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
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
<?php
if(id_top_permission("a")!=1){    
    
permission_fail();            
}
// Status Package Module
$status_module=select_query("status_module","cms_status_module","id","18");
if(
$status_module[0]!=1)    {    
    
fieldset_no_module();
}
if(
$_SESSION[dbname]!= "nversion_62"){
$navig['project']="ผลงานของเรา";
$navig['project_update']="เพิ่มข้อมูล";
navigator($navig);
echo
"<br>";
bar_header("เพิ่มข้อมูล"); // Bar_Header
fieldset_top("ผลงานของเรา");
}else{
$navig['project']="สินค้า/บริการ";
$navig['project_update']="เพิ่มข้อมูล";
navigator($navig);
echo
"<br>";
bar_header("เพิ่มข้อมูล"); // Bar_Header
fieldset_top("สินค้า/บริการ");
}
//include_once("class.upload.php");


if($p_topic!="")                                        {  $topic=trim($p_topic);                                                        }
if(
$p_evar!="")                                        {  $fulltexts=trim($p_evar);                                                    }
if(
$p_price!="")                                        {  $price=trim($p_price);                                                        }
    
$userfile1_name=trim($_FILES['userfile1']['name']);
$userfile2_name=trim($_FILES['userfile2']['name']);
$userfile3_name=trim($_FILES['userfile3']['name']);
$userfile4_name=trim($_FILES['userfile4']['name']);
$userfile5_name=trim($_FILES['userfile5']['name']);

// เช็คไฟล์ว่าถูกต้องหรือไม่
if($userfile1_name!="")            {    check_pic($userfile1_name,1);    }
if(
$userfile2_name!="")            {    check_pic($userfile2_name,2);    }
if(
$userfile3_name!="")            {    check_pic($userfile3_name,3);    }
if(
$userfile4_name!="")            {    check_pic($userfile4_name,4);    }
if(
$userfile5_name!="")            {    check_file($userfile5_name,5);    }
    

$dlink "$_SESSION[web_name]/mainfile/";
// Create_Filename
if($userfile1_name!="")    {
    
//*********************** ReSize *************************
//    // กำหนดชื่อไฟล์ที่ upload ใหม่ ทั้งนี้เพื่อให้ ไฟล์ไม่ซ้ำกัน
//        $str  = "123456789abcdefghijkmnpqrstuvwxyz";
//        $pic1 = substr(str_shuffle($str), 0, 9);
//        $strings = end(explode('.', $userfile1_name));
//        $strings = strtolower($strings);
//        $name1="pic$pic1.$strings";
//        $dlink="$_SESSION[web_name]/mainfile/".$name1;
//        $hup = new upload($_FILES['userfile1']);
//        if($hup->uploaded){
//            $hup->image_resize = true;
//            $hup->image_y  = 300;
//            $hup->image_x = 400;
//            $hup->image_ratio = true;            
//            $hup->jpeg_quality = 95;
//            $hup->image_ratio_no_zoom_in = true;
//            $hup->file_new_name_body = "pic{$pic1}";
//            $hup->Process("$_SESSION[web_name]/mainfile/");
//            if($hup->processed){                
//            }
//        }
  
  
$name1 'pic'.create_filename($userfile1_name);
  
upload_file_to_server($dlink.$name1$_FILES['userfile1'], '''600''400');
  

if(
$userfile2_name!="")    {    
//    //*********************** ReSize *************************
//    // กำหนดชื่อไฟล์ที่ upload ใหม่ ทั้งนี้เพื่อให้ ไฟล์ไม่ซ้ำกัน
//        $str  = "123456789abcdefghijkmnpqrstuvwxyz";
//        $pic2 = substr(str_shuffle($str), 0, 9);
//        $strings = end(explode('.', $userfile2_name));
//        $strings = strtolower($strings);
//        $name2="pic$pic2.$strings";
//        $dlink="$_SESSION[web_name]/mainfile/".$name2;
//        $hup = new upload($_FILES['userfile2']);
//        if($hup->uploaded){
//            $hup->image_resize = true;
//            $hup->image_y  = 300;
//            $hup->image_x = 400;
//            $hup->image_ratio = true;            
//            $hup->jpeg_quality = 95;
//            $hup->image_ratio_no_zoom_in = true;
//            $hup->file_new_name_body = "pic{$pic2}";
//            $hup->Process("$_SESSION[web_name]/mainfile/");
//            if($hup->processed){
//                
//            }
//        }
//    //*******************************************************
  
  
$name2 'pic'.create_filename($userfile2_name);
  
upload_file_to_server($dlink.$name2$_FILES['userfile2'], '''600''400');
  

if(
$userfile3_name!="")    {    
//    //*********************** ReSize *************************
//    // กำหนดชื่อไฟล์ที่ upload ใหม่ ทั้งนี้เพื่อให้ ไฟล์ไม่ซ้ำกัน
//        $str  = "123456789abcdefghijkmnpqrstuvwxyz";
//        $pic3 = substr(str_shuffle($str), 0, 9);
//        $strings = end(explode('.', $userfile3_name));
//        $strings = strtolower($strings);
//        $name3="pic$pic3.$strings";
//        $dlink="$_SESSION[web_name]/mainfile/".$name3;
//        $hup = new upload($_FILES['userfile3']);
//        if($hup->uploaded){
//            $hup->image_resize = true;
//            $hup->image_y  = 300;
//            $hup->image_x = 400;
//            $hup->image_ratio = true;            
//            $hup->jpeg_quality = 95;
//            $hup->image_ratio_no_zoom_in = true;
//            $hup->file_new_name_body = "pic{$pic3}";
//            $hup->Process("$_SESSION[web_name]/mainfile/");
//            if($hup->processed){
//                
//            }
//        }
//    //*******************************************************
  
  
$name3 'pic'.create_filename($userfile3_name);
  
upload_file_to_server($dlink.$name3$_FILES['userfile3'], '''600''400');
  

if(
$userfile4_name!="")    {    
//    //*********************** ReSize *************************
//    // กำหนดชื่อไฟล์ที่ upload ใหม่ ทั้งนี้เพื่อให้ ไฟล์ไม่ซ้ำกัน
//        $str  = "123456789abcdefghijkmnpqrstuvwxyz";
//        $pic4 = substr(str_shuffle($str), 0, 9);
//        $strings = end(explode('.', $userfile4_name));
//        $strings = strtolower($strings);
//        $name4="pic$pic4.$strings";
//        $dlink="$_SESSION[web_name]/mainfile/".$name4;
//        $hup = new upload($_FILES['userfile4']);
//        if($hup->uploaded){
//            $hup->image_resize = true;
//            $hup->image_y  = 300;
//            $hup->image_x = 400;
//            $hup->image_ratio = true;            
//            $hup->jpeg_quality = 95;
//            $hup->image_ratio_no_zoom_in = true;
//            $hup->file_new_name_body = "pic{$pic4}";
//            $hup->Process("$_SESSION[web_name]/mainfile/");
//            if($hup->processed){
//                
//            }
//        }
//    //*******************************************************
  
  
$name4 'pic'.create_filename($userfile4_name);
  
upload_file_to_server($dlink.$name4$_FILES['userfile4'], '''600''400');
  


if(
$userfile5_name!="")    {
        
$name5=create_filename($userfile5_name);        
        
$dlink="$_SESSION[web_name]/mainfile/".$name5;
        
upload_file_to_server($dlink,$_FILES['userfile5']);        


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

    
$d1=select_max_query0("orders","cms_news");
            if (
$d1[0]=="")                    {            $d1[0]="1";                        }

//#########เพิ่มข้อมูลลงในฐาน    
        
$sql="INSERT INTO `cms_project` (`id` ,`topic` ,`fulltexts` ,`pic1` ,`pic2` ,`pic3` ,`pic4` ,`files` ,`status`,`price`) VALUES ('', '$topic', '$fulltexts', '$name1', '$name2', '$name3', '$name4', '$name5', '1','$price')";
        
mysql_query($sql) or die(mysql_error());

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

?>