/home/banprang/domains/plai.go.th/public_html/coremain/module/blog/blog_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
<?php
if ($_SESSION['id_sub'] == "9999")
  
$navig['blog'] = "ติอต่อเรา";
else
  
$navig['blog'] = $data_name_menu_sub['name'];
$navig['blog_update'] = $msg_edit;
navigator($navig);
echo 
"<br>";
bar_header($_SESSION['bar_name']); // Bar_Header
fieldset_top($_SESSION['bar_name']);

if (
$p_check_pic1 != "") {
  
$check_pic1 trim($p_check_pic1);
}
if (
$p_check_pic2 != "") {
  
$check_pic2 trim($p_check_pic2);
}
if (
$p_check_pic3 != "") {
  
$check_pic3 trim($p_check_pic3);
}

$userfile1_name trim($_FILES['userfile1']['name']);
$userfile2_name trim($_FILES['userfile2']['name']);
$userfile3_name trim($_FILES['userfile3']['name']);

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

// Create_Filename
if ($userfile1_name != "") {
  
$name1 create_filename($userfile1_name);
  
$dlink "$_SESSION[web_name]/mainfile/" $name1;
  
delete_filename("cms_blog""file1"$_SESSION['id_sub'], "$_SESSION[web_name]/mainfile/""id_blog");
  
upload_file_to_server($dlink$_FILES['userfile1']);
}
if (
$userfile2_name != "") {
  
$name2 create_filename($userfile2_name);
  
$dlink "$_SESSION[web_name]/mainfile/" $name2;
  
delete_filename("cms_blog""file2"$_SESSION['id_sub'], "$_SESSION[web_name]/mainfile/""id_blog");
  
upload_file_to_server($dlink$_FILES['userfile2']);
}
if (
$userfile3_name != "") {
  
$name3 create_filename($userfile3_name);
  
$dlink "$_SESSION[web_name]/mainfile/" $name3;
  
delete_filename("cms_blog""file3"$_SESSION['id_sub'], "$_SESSION[web_name]/mainfile/""id_blog");
  
upload_file_to_server($dlink$_FILES['userfile3']);
}

// ######## เอาไฟล์ออกจากระบบ #######
if ($check_pic1 == "1" && $userfile1_name == "") {
  
check_pic_out("cms_blog""file1"$_SESSION['id_sub'], "$_SESSION[web_name]/mainfile/""id_blog");
  
$name1 "";
}
if (
$check_pic2 == "1" && $userfile2_name == "") {
  
check_pic_out("cms_blog""file2"$_SESSION['id_sub'], "$_SESSION[web_name]/mainfile/""id_blog");
  
$name2 "";
}
if (
$check_pic3 == "1" && $userfile3_name == "") {
  
check_pic_out("cms_blog""file3"$_SESSION['id_sub'], "$_SESSION[web_name]/mainfile/""id_blog");
  
$name3 "";
}

$fulltexts str_replace("'""''"$fulltexts);
$sql "UPDATE `cms_blog` SET `fulltexts` = '$fulltexts' ,file1='$name1', file2='$name2', file3='$name3' WHERE `id_sub` = '$_SESSION[id_sub]'";
$result mysql_query($sql) or die(mysql_error());

msg_update_data(); // ข้อความแก้ไขแล้ว
refresh_data("index.php?mod=blog&path=blog&id_sub=" $_SESSION['id_sub'], "2"); // refresh หน้าจอ
fieldset_down();
?>