Server IP : 119.59.102.212 / Your IP : 3.149.249.184 Web Server : Apache/2 System : Linux narin 2.6.32-042stab142.1 #1 SMP Tue Jan 28 23:44:17 MSK 2020 x86_64 User : yangkam ( 1022) PHP Version : 5.6.40 Disable Function : exec,system,passthru,shell_exec,proc_close,proc_open,dl,popen,show_source,posix_kill,posix_mkfifo,posix_getpwuid,posix_setpgid,posix_setsid,posix_setuid,posix_setgid,posix_seteuid,posix_setegid,posix_uname MySQL : ON | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /home/yangkam/domains/yangkam.go.th/public_html/coremain/module/gallery/ |
Upload File : |
<?php // 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['gallery'] = "ภาพกิจกรรม"; navigator($navig); echo "<br>"; bar_header("ภาพกิจกรรม"); fieldset_top("ภาพกิจกรรม"); } else { $navig['gallery'] = "ผลงานที่ผ่านมา"; navigator($navig); echo "<br>"; bar_header("ผลงานที่ผ่านมา"); fieldset_top("ผลงานที่ผ่านมา"); } import_request_variables('pG', 'p_'); if($p_g_type!="") { $g_type=trim($p_g_type); } if($p_yearthai!="") { $yearthai=trim($p_yearthai); } if($p_id_hide!="") { $id_hide=trim($p_id_hide); } if($p_id_show!="") { $id_show=trim($p_id_show); } if($p_id_delsss!="") { $id_delsss=trim($p_id_delsss); } if($p_startrow!="") { $startrow=trim($p_startrow); } if($p_viewAsAnother!="") { $viewAsAnother=trim($p_viewAsAnother); } //###################### สำหรับ Admin if ($_SESSION['admin_web'] == "admin" or ( id_top_permission("b"))) { // Hide - Show news if ($id_hide != "") { $sql = "UPDATE port_gallery_topic SET status='0' WHERE id_topic='$id_hide'"; mysql_query($sql); } if ($id_show != "") { $sql = "UPDATE port_gallery_topic SET status='1' WHERE id_topic='$id_show'"; mysql_query($sql); } // Delete port_gallery_topic if ($id_delsss != "") { // delete port_gallery_topic $sql = "delete from port_gallery_topic where id_topic='$id_delsss'"; $result = mysql_query($sql); // delete file $sql = "SELECT pic FROM port_gallery_record WHERE id_topic='$id_delsss'"; $result = mysql_query($sql); while ($data = mysql_fetch_array($result)) { if ($data[0] != "") { if(file_exists("$_SESSION[web_name]/gallery/$data[0]")) unlink("$_SESSION[web_name]/gallery/$data[0]"); if(file_exists("$_SESSION[web_name]/gallery/$data[0]")) unlink("$_SESSION[web_name]/gallery/$data[0]"); } } // delete port_gallery_record $sql = "delete from port_gallery_record where id_topic='$id_delsss'"; $result = mysql_query($sql); } if ($_SESSION['check_size'] != "1") { button_add("index.php?mod=gallery_add&path=gallery"); // Add_News } else { echo "<br>"; } } // ################################ภาพกิจกรรม ################################### $row_per_page = 20; //กำหนดจำนวนบรรทัดต่อหน้า if ($_SESSION['admin_web'] == "admin" || ( id_top_permission("b"))) { //$query = "SELECT DISTINCT a.id_topic, a . * ,b.pic,a.block FROM `port_gallery_topic` AS a INNER JOIN port_gallery_record AS b ON a.id_topic = b.id_topic GROUP BY a.id_topic ORDER BY a.id_topic DESC"; $query = "SELECT a.*, b.pic FROM port_gallery_topic AS a LEFT JOIN port_gallery_record AS b ON a.id_topic = b.id_topic GROUP BY a.id_topic ORDER BY a.id_topic DESC"; //$query_count = "select count(a.id_topic) FROM `port_gallery_topic` AS a INNER JOIN port_gallery_record AS b ON a.id_topic = b.id_topic GROUP BY a.id_topic ORDER BY a.id_topic DESC"; $query_count = "SELECT count(id_topic) FROM port_gallery_topic"; } else { // $query = "SELECT DISTINCT a.id_topic, a . * ,b.pic,a.block FROM `port_gallery_topic` AS a INNER JOIN port_gallery_record AS b ON a.id_topic = b.id_topic WHERE a.status=1 GROUP BY a.id_topic ORDER BY a.id_topic DESC"; $query = "SELECT a.*, b.pic FROM port_gallery_topic AS a LEFT JOIN port_gallery_record AS b ON a.id_topic = b.id_topic WHERE a.status = 1 GROUP BY a.id_topic ORDER BY a.id_topic DESC"; //$query_count = "select count(a.id_topic) FROM `port_gallery_topic` AS a INNER JOIN port_gallery_record AS b ON a.id_topic = b.id_topic WHERE a.status=1 GROUP BY a.id_topic ORDER BY a.id_topic DESC"; $query_count = "SELECT count(id_topic) FROM port_gallery_topic WHERE status = 1"; } if (empty($startrow)) { //ลองตรวจดูว่าค่าแถวเริ่มต้นที่จะแสดงไม่ได้กำหนดหรือเปล่า ถ้าไม่ได้กำหนด จะกำหนดให้เป็น 0 $startrow = 0; } $result_count = mysql_query($query_count); $row = mysql_fetch_array($result_count); $total_row = $row[0]; //ได้ค่าจำนวนบรรทัดทั้งหมดที่จะต้องแสดง $total_page = intval((($total_row - 1) / $row_per_page) + 1); //หาค่าจำนวนหน้าทั้งหมดที่ต้องแสดง $current_page = (($startrow) / $row_per_page) + 1; //หาว่าหน้าที่แสดงอยู่ปัจจุบันเป็นหน้าที่เท่าไหร่ $count = 0; $result = mysql_query($query . " LIMIT $startrow,$row_per_page"); ?> <table width='97%' border='0' cellpadding='0' cellspacing='0' align='center'> <?php while ($data = mysql_fetch_array($result)) { ?> <tr> <td width='20%' valign='top'> <?php if ($data['pic'] != "") { box_picture_firstpage("../gallery/$data[pic]", "index.php?mod=gallery_update&id_update=$data[id_topic]&block=$data[block]&path=gallery"); } else { box_nopicture_firstpage("index.php?mod=gallery_update&id_update=$data[id_topic]&block=$data[block]&path=gallery"); } ?> </td> <td width='3%' valign='top'></td> <td width='75%' height='100' valign='top'> <img SRC='coremain/images/marker.gif'> <?= strip_tags($data['fulltexts']); ?> </td> </tr> <?php if ($_SESSION['admin_web'] == "admin" || ( id_top_permission("b"))) { ?> <tr> <td valign='top' align=center> <?php if ($data['status'] == '1') { ?> <a href='index.php?mod=gallery&path=gallery&id_hide=<?= $data['id_topic'] ?>'><img src='coremain/images/show.gif' border='0' title='ซ่อน'></a> <?php } else { ?> <a href='index.php?mod=gallery&path=gallery&id_show=<?= $data['id_topic'] ?>'><img src='coremain/images/hide.gif' border='0' title='แสดง'></a> <?php } ?> <!--// update --> <a href='index.php?mod=gallery_edit&path=gallery&id_update=<?= $data['id_topic'] ?>'><img src='coremain/images/edit.gif' border='0' title='แก้ไขข้อมูล'></a> <!--// delete --> <a href='index.php?mod=gallery&path=gallery&id_delsss=<?= $data['id_topic'] ?>' onclick='return goURL();'><img src='coremain/images/del1.gif' border='0' title='ลบข้อมูล'></a> </td> </tr> <?php } } ?> </table> <?php if ($total_page > 1) { //ตรวจดูว่าถ้าจำนวนหน้าทั้งหมดมีไม่เกิน 1 หน้า ต้องแสดงบรรทัดที่จะให้เลือกหน้า $previous_page = $current_page - 1; //หาว่าหน้าก่อนหน้าปัจจุบันคือหน้าอะไร $next_page = $current_page + 1; //หาว่าหน้าถัดจากหน้าปัจจุบันคืออะไร if ($previous_page > 0) { //ถ้าหน้าก่อนหน้าติดลบหรือเป็นศูนย์แสดงว่าไม่สามารถแสดงหน้าก่อนหน้าได้ $new_startrow = $startrow - $row_per_page; $left_page_show = "<A HREF=index.php?mod=gallery&path=gallery&startrow=$new_startrow><b>ก่อนหน้า</b></A> "; } else { $left_page_show = "<b><font color='$datatm[color1]'>ก่อนหน้า</font></b> "; } if ($next_page > $total_page) { //ถ้าหน้าถัดไป มากกว่าจำนวนหน้าทั้งหมด แสดงว่าไม่สามารถแสดงหน้าถัดไปได้ $right_page_show = " <b><font color='$datatm[color1]'>ต่อไป</font></b>"; } else { $new_startrow = $startrow + $row_per_page; $right_page_show = " <A HREF=index.php?mod=gallery&path=gallery&startrow=$new_startrow><b>ต่อไป</b></A>"; } $middle_page_show = ""; for ($i = 1; $i <= $total_page; $i++) { //วนลูปแสดงหน้าทั้งหมด if ($i == $current_page) { //ถ้าหน้าที่พิมพ์เป็นหน้าเดียวกับหน้าปัจจุบัน แสดงให้ไม่สามารถคลิ๊กได้ $middle_page_show .= " <font color='ff0000'><b>[</font><font color='$datatm[color1]'>$i</font><font color='ff0000'>]</font></b> "; } else { $new_startrow = (($i - 1) * $row_per_page); $middle_page_show .= " <A HREF=index.php?mod=gallery&path=gallery&startrow=$new_startrow> <b>$i</b> </A> "; } } $page_show = $left_page_show . $middle_page_show . $right_page_show; } else { $page_show = ""; } echo "<br> <font color='0000ff'>$page_show</font>"; fieldset_down(); ?> <script language="JavaScript"> <!-- function goURL() { var blnLink blnLink = confirm("Click OK เพื่อยืนยันการลบข้อมูล?") if (!blnLink) { return false; } return true; } //--> </script>