PageRenderTime 37ms CodeModel.GetById 20ms RepoModel.GetById 0ms app.codeStats 0ms

/web kết quả xổ số ketqua.net/Code/admin/MenuProduct.php

https://gitlab.com/phamngsinh/baitaplon_sinhvien
PHP | 237 lines | 206 code | 31 blank | 0 comment | 27 complexity | 1bb322c93aa9e8d30bcc6824323ed1ef MD5 | raw file
  1. <? include "check.php";?>
  2. <?
  3. if($_POST['InsertAds']) {
  4. mysql_query("INSERT INTO ".menu_product." SET
  5. category='".$_POST['category']."',stt='".$_POST['order']."',parent='".$_POST['parent']."',,stthome='".$_SESSION['stthome']."'");
  6. echo "Thêm '".$_POST['category']."' thành công";
  7. }
  8. if($_POST['Ads']) {
  9. mysql_query("UPDATE ".menu_product." SET
  10. category='".$_POST['category']."',stt='".$_POST['order']."',parent='".$_POST['parent']."',,stthome='".$_SESSION['stthome']."' WHERE id='".intval($_GET['Edit'])."'");
  11. echo "Cập nhật '".$_POST['category']."' thành công";
  12. }
  13. if($_POST['ItemDel']) {
  14. $action='';
  15. if($_POST['element']=='') {
  16. echo '<script>alert(\'Mời bạn chọn ít nhất 1 bản tin\')</script>';
  17. $action=true;
  18. }
  19. if($action=='') {
  20. mysql_query("DELETE FROM ".menu_product." WHERE id in (".implode(",",$_POST['element']).")");
  21. mysql_query("DELETE FROM ".menu_product." WHERE parent in (".implode(",",$_POST['element']).")");
  22. }
  23. }
  24. if($_POST['ItemHid']) {
  25. $action='';
  26. if($_POST['element']=='') {
  27. echo '<script>alert(\'Mời bạn chọn ít nhất 1 bản tin\')</script>';
  28. $action=true;
  29. }
  30. if($action=='') {
  31. mysql_query("UPDATE ".menu_product." SET status='false' WHERE id in (".implode(",",$_POST['element']).")");
  32. }
  33. }
  34. if($_POST['ItemShow']) {
  35. $action='';
  36. if($_POST['element']=='') {
  37. echo '<script>alert(\'Mời bạn chọn ít nhất 1 bản tin\')</script>';
  38. $action=true;
  39. }
  40. if($action=='') {
  41. mysql_query("UPDATE ".menu_product." SET status='true' WHERE id in (".implode(",",$_POST['element']).")");
  42. }
  43. }
  44. if($_GET['Hidden']!=""){
  45. mysql_query("UPDATE ".menu_product." SET status='false' WHERE id = ".intval($_GET['Hidden'])."");
  46. }
  47. if($_GET['Display']!=""){
  48. mysql_query("UPDATE ".menu_product." SET status='true' WHERE id = ".intval($_GET['Display'])."");
  49. }
  50. if($_POST['Update']){
  51. $orderNoList = $_POST["orderid"];
  52. foreach ($orderNoList as $k => $v){
  53. mysql_query("UPDATE ".menu_product." SET stt='".$v."' WHERE id = ".$k."");
  54. }
  55. }
  56. ?>
  57. <? if($_GET['Edit']=='') {?>
  58. <style type="text/css">
  59. <!--
  60. .style1 {font-weight: bold}
  61. -->
  62. </style>
  63. <div id="k2AdminContainer" class="K2AdminViewItems">
  64. <table class="adminlist">
  65. <form action="" method="post" enctype="multipart/form-data" >
  66. <tr class="row0">
  67. <td width="21%" class="height_row"><div align="right">Tên nhóm </div></td>
  68. <td width="28%" class="height_row">
  69. <input name="category" type="text" class="input-text" id="category" /> </td>
  70. <td width="17%" class="height_row"><div align="right">Thuộc nhóm </div></td>
  71. <td width="34%" class="height_row"><select name="parent" class="input-text">
  72. <option value="0">Không thuộc nhóm nào</option>
  73. <? CategoryParent($_POST['parent'],menu_product)?>
  74. </select></td>
  75. </tr>
  76. <tr class="row1">
  77. <td class="height_row"><div align="right">Số thứ tự </div></td>
  78. <td class="height_row">
  79. <select name="order" class="input-text" >
  80. <? order(1,50,$_POST['order']+1)?>
  81. </select> </td>
  82. <td class="height_row"><div align="right">Thứ tự trang chủ </div></td>
  83. <td class="height_row"><select name="stthome" class="input-text" id="stthome" >
  84. <? order(1,50,$_POST['stthome']+1)?>
  85. </select></td>
  86. </tr>
  87. <tr class="row0">
  88. <td>&nbsp;</td>
  89. <td colspan="3">
  90. <input name="InsertAds" type="submit" id="InsertAds" value="Thêm category" <? echo $_SESSION['modmana'] == '2'?'disabled':''?>/>
  91. <input type="reset" name="Submit2" value="Nhập Lại" <? echo $_SESSION['modmana'] == '2'?'disabled':''?>/> </td>
  92. </tr>
  93. </form>
  94. </table>
  95. </div>
  96. <? }?>
  97. <? if($_GET['Edit']!='') {?>
  98. <?
  99. $sqlstr=mysql_query("SELECT * FROM ".menu_product." WHERE id='".intval($_GET['Edit'])."'");
  100. if(mysql_num_rows($sqlstr)>0) {
  101. $row=mysql_fetch_assoc($sqlstr)
  102. ?>
  103. <div id="k2AdminContainer" class="K2AdminViewItems">
  104. <table class="adminlist">
  105. <form method="post" action="" enctype="multipart/form-data">
  106. <tr class="row0">
  107. <td width="22%" class="height_row"><div align="right">Tên nhóm </div></td>
  108. <td width="28%" class="height_row">
  109. <input name="category" type="text" class="input-text" id="category" value="<?=$row['category']?>" /> </td>
  110. <td width="17%" class="height_row"><div align="right">Thuộc nhóm </div></td>
  111. <td width="33%" class="height_row"><select name="parent" class="input-text" id="parent">
  112. <option value="0">Không thuộc nhóm nào</option>
  113. <? CategoryParent($row['parent'],menu_product)?>
  114. </select></td>
  115. </tr>
  116. <tr class="row1">
  117. <td class="height_row"><div align="right">Số thứ tự </div></td>
  118. <td class="height_row">
  119. <select name="order" class="input-text" >
  120. <? order(1,50,$row['stt'])?>
  121. </select> </td>
  122. <td class="height_row"><div align="right">Thứ tự trang chủ </div></td>
  123. <td class="height_row"><select name="stthome" class="input-text" id="stthome" >
  124. <? order(1,50,$row['stthome'])?>
  125. </select></td>
  126. </tr>
  127. <div align="right"></div>
  128. <tr class="row0">
  129. <td>&nbsp;</td>
  130. <td colspan="3">
  131. <input type="submit" name="Ads" value="Sửa category" <? echo $_SESSION['modmana'] == '2'?'disabled':''?>/>
  132. <input type="reset" name="Submit2" value="Nhập Lại" <? echo $_SESSION['modmana'] == '2'?'disabled':''?>/> </td>
  133. </tr>
  134. </form>
  135. </table>
  136. </div>
  137. <? }
  138. }?>
  139. <div id="k2AdminContainer" class="K2AdminViewItems">
  140. <form method="post" action="" name="rowsDeleteForm" id="rowsDeleteForm">
  141. <div>
  142. <a href="" onclick="if (markAllRows('rowsDeleteForm')) return false;" style="font-family:Tahoma; font-size:11px; font-weight:bolder">[Check All]</a> /
  143. <a href="" onclick="if (unMarkAllRows('rowsDeleteForm')) return false;" style="font-family:Tahoma; font-size:11px; font-weight:bolder">[Uncheck All]</a> &nbsp;&nbsp;<input name="ItemDel" type="submit" id="ItemDel" onclick="return confirm('Bạn có chắc không ?');" value="Xóa nhóm này" <? echo $_SESSION['modmana'] == '2'?'disabled':''?> class="ItemDel" />
  144. <input name="ItemHid" type="submit" id="ItemHid" onclick="return confirm('Bạn có chắc không ?');" value="Ẩn nhóm này" <? echo $_SESSION['modmana'] == '2'?'disabled':''?> class="ItemHid" />
  145. <input name="ItemShow" type="submit" id="ItemShow" onclick="return confirm('Bạn có chắc không ?');" value="Hiện nhóm này" <? echo $_SESSION['modmana'] == '2'?'disabled':''?> class="ItemShow" />
  146. <input name="Update" type="submit" id="Update" onclick="return confirm('Bạn có chắc không ?');" value="Cập nhật thay đổi" <? echo $_SESSION['modmana'] == '2'?'disabled':''?> class="ItemUpdate" />
  147. </div>
  148. <table class="adminlist">
  149. <thead>
  150. <tr>
  151. <th>&nbsp;</th>
  152. <th class="title">Tên nhóm</th>
  153. <th>Hiển thị</th>
  154. <th>Trạng Thái</th>
  155. </tr>
  156. </thead>
  157. <tbody>
  158. <?
  159. $sqlstr=mysql_query("SELECT id,category,status,stt FROM ".menu_product." WHERE parent='0' order by stt ASC");
  160. if(mysql_num_rows($sqlstr)>0){
  161. $le = 0;
  162. while($row=mysql_fetch_assoc($sqlstr)){ $le++;
  163. ?>
  164. <tr class="odd <?=($le%2==0?'row0':'row1')?>" style="cursor:pointer" ondblclick="location.href='index.php?menu=<?=$_GET['menu']?>&site=<?=$_GET['site']?>&Edit=<?=$row['id']?>'">
  165. <td width="20" height="15" align="center" bgcolor="#EEEEEE" >
  166. <input type="checkbox" name="element[]" id="element" value="<?=$row['id']?>" /></td>
  167. <td width="601"><span class="style1">
  168. <strong><?=$row['category']?></strong>
  169. </span></td>
  170. <td width="50" ><div align="center">
  171. <input name="orderid[<?=$row['id']?>]" type="text" style="width:50px; text-align:center;" id="orderid[<?=$row['id']?>]" value="<?=$row['stt']?>"/>
  172. </div></td>
  173. <td width="115" align="center" ondblclick="location.href='index.php?menu=<?=$_GET['menu']?>&site=<?=$_GET['site']?>&<? echo $row['status']=='true'?'Hidden':'Display';?>=<?=$row['id']?>'" style="cursor:pointer"><strong><? echo $row['status']=='true'?'Hiện':'Ẩn';?></strong></td>
  174. </tr>
  175. <?
  176. $sql=mysql_query("SELECT id,category,status,stt FROM ".menu_product." WHERE parent='".$row['id']."' order by stt ASC");
  177. if(mysql_num_rows($sql)>0){
  178. while($rs=mysql_fetch_assoc($sql)){
  179. ?>
  180. <tr class="odd <?=($le%2==0?'row0':'row1')?>">
  181. <td width="20" height="15" align="center" bgcolor="#EEEEEE" >
  182. <input type="checkbox" name="element[]" id="element" value="<?=$rs['id']?>" /></td>
  183. <td width="601" style="cursor:pointer; padding-left:30px;" ondblclick="location.href='index.php?menu=<?=$_GET['menu']?>&site=<?=$_GET['site']?>&Edit=<?=$rs['id']?>'">&raquo;&nbsp;<?=$rs['category']?></td>
  184. <td width="50" ><div align="center">
  185. <input name="orderid[<?=$rs['id']?>]" type="text" style="width:50px; text-align:center;" id="orderid[<?=$rs['id']?>]" value="<?=$rs['stt']?>"/>
  186. </div></td>
  187. <td width="115" align="center" ondblclick="location.href='index.php?menu=<?=$_GET['menu']?>&site=<?=$_GET['site']?>&<? echo $rs['status']=='true'?'Hidden':'Display';?>=<?=$rs['id']?>'" style="cursor:pointer;"><? echo $row['status']=='true'?'Hiện':'Ẩn';?></td>
  188. </tr>
  189. <? }
  190. }?>
  191. <? }
  192. }?>
  193. </tbody>
  194. <tfoot>
  195. <tr>
  196. <td colspan="15">
  197. <div class="pagination">4
  198. <a class="number current">1</a><a href="#" class="number" title="2" onclick="javascript: document.adminForm.limitstart.value=5; submitform();return false;">2</a>
  199. <a href="#" class="number" title="3" onclick="javascript: document.adminForm.limitstart.value=10; submitform();return false;">3</a>4
  200. </div>
  201. </td>
  202. </tr>
  203. </tfoot>
  204. </table>
  205. </form>
  206. </div>