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
|
<?php // Status Package Module $status_module=select_query("status_module","cms_status_module","id","28"); if($status_module[0]!=1) { fieldset_no_module(); } if(id_sub_permission(7)!=1){ permission_fail(); } $navig['download']="ดาวน์โหลด"; $navig['edit_download']="แก้ไขข้อมูล"; navigator($navig); echo "<br>"; bar_header("ดาวน์โหลด"); // Bar_Header fieldset_top("ดาวน์โหลด"); import_request_variables('pG', 'p_'); if($p_id_group!="") { $id_group=trim($p_id_group); } if($p_update_download_g!="") { $update_download_g=trim($p_update_download_g); } if($p_update_download_gclick!="") { $update_download_gclick=trim($p_update_download_gclick); }
if($p_id_sub1!="") { $id_sub1=trim($p_id_sub1); } if($p_update_download_s!="") { $update_download_s=trim($p_update_download_s); } if($p_update_download_sclick!="") { $update_download_sclick=trim($p_update_download_sclick); } if($p_topic!="") { $topic=trim($p_topic); } if($p_download!="") { $download=trim($p_download); } if($p_name_group!="") { $name_group=trim($p_name_group); } if($p_download_url!="") { $download_url=trim($p_download_url); } $userfile1_name=trim($_FILES['userfile1']['name']); if($p_detail!="") { $detail=trim($p_detail); }
// ################################################# แก้ไขหัวข้อดาวน์โหลด if ($id_group != "" && $update_download_g == "1" && $update_download_gclick == "1") { $sql = "UPDATE `cms_download_group` SET `name_group` = '$name_group' WHERE `id_group` = '$id_group'"; $result = mysql_query($sql); echo"<br><br><center>ข้อมูลได้ถูกแก้ไขแล้ว<br><br></enter>"; echo"<meta http-equiv='refresh' content='2; url=index.php?mod=download&path=download'>"; // include('coremain/footer.php'); exit; } // ############################################## แก้ไขส่วนย่อยดาวน์โหลด if ($id_sub1 != "" && $update_download_s == "1" && $update_download_sclick == "1") { //********************** ตรวจสอบว่า มีการ Upload File ที่ 1 หรือไม*******************************************่ if ($userfile1_name != "") { // กำหนดชื่อไฟล์ที่ upload ใหม่ ทั้งนี้เพื่อให้ ไฟล์ไม่ซ้ำกัน $sqlmax1 = "select max(id+1) from cms_download"; $resultmax1 = mysql_query($sqlmax1); $datamax1 = mysql_fetch_row($resultmax1); // ลบไฟล์เก่าออกก่อน $sql1 = "select download from cms_download where id='$id_sub1'"; $result1 = mysql_query($sql1); $data1 = mysql_fetch_row($result1); if ($data1[0] != "") { unlink("$_SESSION[web_name]/mainfile/$data1[0]"); } // ชื่อไฟล์ //$strings = substr($userfile1_name, -4); $strings = get_file_type($userfile1_name); $name1 = "fileupdate$datamax1[0]$strings"; $dlink = "$_SESSION[web_name]/mainfile/" . $name1; $temp_name = $_FILES['userfile1']; upload_file_to_server($dlink, $temp_name); // if (is_uploaded_file($_FILES['userfile1']['tmp_name'])) { // if (!move_uploaded_file($temp_name, $dlink)) { // // } // } }
$sql = "UPDATE `cms_download` SET `topic` = '$topic', `download` = '$name1', `detail` = '$detail' WHERE `id` = '$id_sub1'"; $result = mysql_query($sql); echo"<br><br><center>ข้อมูลได้ถูกแก้ไขแล้ว<br><br></enter>"; echo"<meta http-equiv='refresh' content='2; url=index.php?mod=download&path=download'>"; // include('coremain/footer.php'); exit; }
// แสดงข้อมูล การแก้ไขหัวข้อดาวน์โหลด if ($id_group != "" && $update_download_g == "1" && $update_download_gclick == "") { $sql = "SELECT * FROM cms_download_group where id_group='$id_group'"; $result = mysql_query($sql); $data = mysql_fetch_array($result); ?> <br> <FORM METHOD=POST ACTION='index.php?mod=edit_download&path=download&id_group=<?php echo $data['id_group'] ?>&update_download_g=1&update_download_gclick=1'> <table width='100%' border='0' align='center' cellpadding='1' cellspacing='1' > <tr height='20'> <td width=5%> <center> <img src='coremain/images/marker.gif'> <b>หัวข้อดาวน์โหลด</b> <INPUT TYPE='text' NAME='name_group' value='<?php echo $data['name_group'] ?>' size='35'> <br><br> <INPUT TYPE='submit' value='แก้ไขข้อมูล' onmouseover=this.style.cursor='hand'> </center> </td> </tr> </table> </FORM> <?php }
// แสดงการแก้ไขข้อมูลส่วนย่อยดาวน์โหลด if ($id_sub1 != "" and $update_download_s == "1" and $update_download_sclick == "") { $sql = "SELECT * FROM cms_download where id='$id_sub1'"; $result = mysql_query($sql); $data = mysql_fetch_array($result); ?> <FORM METHOD=POST ACTION='index.php?mod=edit_download&path=download&id_sub1=<?php echo $data['id'] ?>&update_download_s=1&update_download_sclick=1' enctype='multipart/form-data'> <table width='98%' border='0' align='center' cellpadding='1' cellspacing='1' > <tr height='45'> <td width=20%><img src='coremain/images/marker.gif'> <b>ชื่อไฟล์</b></td> <td width='80%'>: <INPUT TYPE='text' NAME='topic' value='<?php echo $data['topic'] ?>' size='35'></td> </tr> <?php text_editor('450', '260', 'รายละเอียดไฟล์', 2, $data['detail'], 'detail'); ?> <!-- <tr height='45'> <td width=13%></td> <td><img src='coremain/images/marker.gif'> <b>รายละเอียดไฟล์</b></td> <td width='55%'> <?php // $oFCKeditor = new FCKeditor('detail'); // $oFCKeditor->BasePath = 'coremain/editor/'; // $oFCKeditor->Value = $data[detail]; // $oFCKeditor->Width = 450; // $oFCKeditor->Height = 260; // $oFCKeditor->Create(); ?> </td> </tr>--> <tr height='20'> <td align="left"><img src='coremain/images/marker.gif'> <b>Upload File</b></td> <td>: <input name='userfile1' type=file size=35></td> </tr> <?php button_text('แก้ไขข้อมูล', 'submit', 2); ?> <!-- <tr height='45'> <td colspan='3' align='center'> <INPUT TYPE='submit' value='แก้ไขข้อมูล' onmouseover=this.style.cursor='hand'></td> </tr>--> </table> </FORM>
<?php }
fieldset_down(); ?>
|