/home/banprang/.trash/files/coremain.3/module/link/link.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
<?php
$navig
['new_page']=$data_name_menu_sub[name];
navigator($navig);
echo 
"<br>";
bar_header("$data_name_menu_sub[name]"); // Bar_Header
fieldset_top("ลิงค์");
import_request_variables('pG''p_');
if(
$p_id_group!="")                {  $id_group=trim($p_id_group);            }
if(
$p_show_link!="")            {  $show_link=trim($p_show_link);        }
if(
$p_id_sub!="")                {  $id_sub=trim($p_id_sub);                }
if(
$p_update_state!="")            {  $update_state=trim($p_update_state);    }
if(
$p_id_link!="")                {  $id_link=trim($p_id_link);            }


// #################Update status Link ##################
     // หัวข้อใหญ่
if ($show_link == "1" and $id_group != "") {
  
$sql "UPDATE `cms_link_group` SET `status` = '1' WHERE id_group='$id_group'";
  
mysql_query($sql);
  
$sql "UPDATE `link` SET `status` = '1' WHERE  id_group='$id_group'";
  
mysql_query($sql);
} else if (
$show_link == "0" and $id_group != "") {
  
$sql "UPDATE `cms_link_group` SET `status` = '0' WHERE id_group='$id_group'";
  
mysql_query($sql);
  
$sql "UPDATE `link` SET `status` = '0' WHERE  id_group='$id_group'";
  
mysql_query($sql);
}
// หัวข้อย่อย
if ($show_link == "1" and $id_link != "") {
  
$sql "UPDATE `cms_link` SET `status` = '1' WHERE id_link='$id_link'";
  
mysql_query($sql);
} else if (
$show_link == "0" and $id_link != "") {
  
$sql "UPDATE `cms_link` SET `status` = '0' WHERE id_link='$id_link'";
  
mysql_query($sql);
}

if(
id_sub_permission($id_sub)) 
    
button_add("index.php?mod=addlink_form_topic&path=link"); // Edit_Data
        

$sql1="SELECT * FROM cms_link_group  WHERE id_sub='$_SESSION[id_sub]' order by id_group";
$result1=mysql_query($sql1);
$ch=mysql_num_rows($result1);
while (
$data mysql_fetch_array($result1)) {
  
// ####################### ส่วนหัวลิงค์ ##################
?>
<table width='100%' border='0' align='center' cellpadding='1' cellspacing='1' bgcolor='<?= $_SESSION['tb_head_bgcolor'?>'>
  <tr height='10' bgcolor='<?= $datatm['bg_textrun'?>'>
    <td width='70%'><img src='coremain/images/com.gif'>&nbsp;<?= $data['name_group'?></td>
  <?php if (id_sub_permission($id_sub)) { ?>
    <td align='right' bgcolor='<?= $datatm['bg_textrun'?>'>
      <!--// เพิ่มข้อมูล -->
      <a href='index.php?mod=addlink_form&path=link&id_group=<?= $data['id_group'?>'><img src='coremain/images/true.gif' border='0' title='เพิ่มลิงค์ย่อย'></a>&nbsp;&nbsp;
      <!--// แสดง ซ่อน -->
      <?php if ($data['status'] == "1") { ?>
        <a href='index.php?mod=link&path=link&id_group=<?= $data['id_group'?>&show_link=0'><img src='coremain/images/show.gif' border='0' title='<?= $title_show ?>'></a>
      <?php } else { ?>
        <a href='index.php?mod=link&path=link&id_group=<?= $data['id_group'?>&show_link=1'><img src='coremain/images/hide.gif' border='0' title='<?= $title_hide ?>'></a>
      <?php ?>
      <!--// แก้ไข -->
      &nbsp;&nbsp;<a href='index.php?mod=edit_link&path=link&id_group=<?= $data['id_group'?>&update_link_g=1'><img src='coremain/images/edit.gif' border='0' title='<?= $title_edit ?>'></a>
      <!--// ลบ -->
      &nbsp;&nbsp;<a href='index.php?mod=del_link&path=link&id_group=<?= $data['id_group'?>&del_link_g=1'><img src='coremain/images/del1.gif' border='0' onclick='return goURL();' title='<?= $title_delete ?>'></a>
    </td>
  <?php ?>
  </tr>
</table>


  <!--// ################## ส่วนลิงค์ย่อย ########################## -->
  <table width='100%' border='0' align='center' cellpadding='2' cellspacing='2' bgcolor='dddddd'>
  <?php
    $sqls 
"SELECT * FROM `cms_link` WHERE `id_group`='$data[id_group]' order by `id_link` asc";
    
$results mysql_query($sqls);
    while (
$datas mysql_fetch_array($results)) {
  
?>
    <tr  bgcolor='eeeeee' height='20' valign="top">
      <td width='5%'>
        
      </td>

      <td width='75%'>

        &nbsp;<img src='coremain/images/bot1.gif'>&nbsp;&nbsp;
    <?
    
if($datas[url]==""){
        echo 
"$datas[msg]";
    }else{
        echo 
"    <a href='$datas[url]' target='_blank'>$datas[msg]</a>";
    }
    
?>
    



      <br/>  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href='index.php?mod=link_full&path=link&id_link=<?= $datas['id_link'?>'>รายละเอียดเพิ่มเติม</a><br/>

      </td>


      <?php if (id_sub_permission($id_sub)) { ?>
      <td width='15%' align='right' bgcolor='eeeeee'>
        <!--// แสดง ซ่อน -->
        <?php if ($datas['status'] == "1" && $data['status'] == "1") { ?>
          <a href='index.php?mod=link&path=link&id_link=<?= $datas['id_link'?>&show_link=0'><img src='coremain/images/show.gif' border='0' title='<?= $title_show ?>'></a>
        <?php } else { ?>
          <a href='index.php?mod=link&path=link&id_link=<?= $datas['id_link'?>&show_link=1'><img src='coremain/images/hide.gif' border='0' title='<?= $title_hide ?>'></a>
        <?php ?>
        <!--// แก้ไข -->
        &nbsp;&nbsp;<a href='index.php?mod=edit_link&path=link&id_link=<?= $datas['id_link'?>&update_link_s=1'><img src='coremain/images/edit.gif' border='0' title='<?= $title_edit ?>'></a>
        <!--// ลบ -->
        &nbsp;&nbsp;<a href='index.php?mod=del_link&path=link&id_link=<?= $datas['id_link'?>&del_link_s=1'><img src='coremain/images/del1.gif' border='0' onclick='return goURL();' title='<?= $title_delete ?>'></a>
      </td>
      <?php ?>
    </tr>
  <?php ?>
  </table>

<?php
}
fieldset_down();
?>
<script language="JavaScript">
<!--
function goURL() {
var blnLink
blnLink = confirm("Click OK เพื่อยืนยันการลบข้อมูล?")

if (!blnLink) { return false; }

return true;
}
//-->
</script>