PageRenderTime 138ms CodeModel.GetById 25ms RepoModel.GetById 0ms app.codeStats 0ms

/web nhacdj.vn php/code/AdminCP/php/songtrash.php

https://gitlab.com/phamngsinh/baitaplon_sinhvien
PHP | 226 lines | 218 code | 8 blank | 0 comment | 43 complexity | 2492c5c6b99750f07e88f1b6ba07d4ee MD5 | raw file
  1. <script type="text/javascript">
  2. $(document).ready(function()
  3. {
  4. $('.movetrash').live("click",function()
  5. {
  6. var ID = $(this).attr("id");
  7. var dataString = 'songID='+ ID;
  8. if(confirm("Bạn muốn khôi phục bài hát này về trạng thái chờ duyệt ?"))
  9. {
  10. $.ajax({
  11. type: "POST",
  12. url: "ajax/Move_Song_Trash.php",
  13. data: dataString,
  14. cache: false,
  15. success: function(html){
  16. $("#trashbody"+ID).fadeOut(200);
  17. }
  18. });
  19. }
  20. return false;
  21. });
  22. });
  23. </script>
  24. <? if ($_SESSION['loginTitle'] == "admin" || $_SESSION['loginTitle'] == "checker") {?>
  25. <script type="text/javascript">
  26. $(document).ready(function()
  27. {
  28. $('.deletetrash').live("click",function()
  29. {
  30. var ID = $(this).attr("id");
  31. var dataString = 'songID='+ ID;
  32. if(confirm("Bạn muốn xóa bài hát này khỏi Cơ sở dữ liệu ?"))
  33. {
  34. $.ajax({
  35. type: "POST",
  36. url: "ajax/Delete_Song.php",
  37. data: dataString,
  38. cache: false,
  39. success: function(html){
  40. $("#trashbody"+ID).fadeOut(200);
  41. }
  42. });
  43. }
  44. return false;
  45. });
  46. });
  47. </script>
  48. <?}?>
  49. <?php
  50. $page = $_GET['p'];
  51. $getErr = $_GET['getErr'];
  52. if(preg_match("/\D/",$page)) {
  53. echo("<br>&nbsp;<p align=center><font class=\"err\">NUMBER FORMAT EXCEPTION!</font></p>");
  54. } else {
  55. $limit=40;
  56. $kw = khongdau( $_GET["kw"] );
  57. if ( empty($kw) ) {
  58. $kw = "";
  59. }
  60. if (empty($page)) {
  61. $offset=0;
  62. }
  63. else {
  64. $offset = ($page-1)*$limit;
  65. }
  66. if($getErr == "on") {
  67. $qString = "?v=songtrash&getErr=on";
  68. } else {
  69. $qString = "?v=songtrash&kw=$kw";
  70. }
  71. if($_POST['DelSongSelect']) {
  72. $action='';
  73. if($_POST['element2']=='') {
  74. echo '<script>alert(\'Thím phải chọn ít nhất 1 bài hát chứ !\')</script>';
  75. $action=true;
  76. }
  77. if($action=='') {
  78. mysql_query("DELETE FROM song WHERE sID in (".implode(",",$_POST['element2']).")");
  79. mysql_query("DELETE FROM comment WHERE sID in (".implode(",",$_POST['element2']).")");
  80. echo '<script>alert(\'Thôi xong CMNR ! Đã xóa những bài Thím vừa chọn !\')</script>';
  81. }
  82. }
  83. ?>
  84. <form action="He-thong.html" name="xoaFrm" method="POST">
  85. <input type="hidden" name="act" value="removetrashSong" />
  86. <input type="hidden" name="back" value="AdminCP.html<?=$qString?>&p=<?=$page?>" />
  87. <input type="hidden" name="ID" />
  88. </form>
  89. <?
  90. $querythumuc = "SELECT sID FROM song AS a LEFT OUTER JOIN category AS b ON a.catID = b.catID LEFT OUTER JOIN singer AS c ON a.singerID = c.singerID LEFT OUTER JOIN trash AS d ON a.sID = d.songid WHERE a.sStatus=3";
  91. $numresults = mysql_query ($querythumuc);
  92. $numrows=mysql_num_rows($numresults);
  93. $pages=intval($numrows/$limit);
  94. if ($pages < ($numrows/$limit)){
  95. $pages=($pages + 1);
  96. }
  97. if($page > $pages || $numrows == "0") {
  98. echo("<h3 align='center'><br></br><br></br><br></br>Không có bài nhạc nào tạm xóa !</h3>");
  99. } else {
  100. $query = "SELECT a.*,b.catID,b.catName,c.singerID,c.singerName,d.* FROM song AS a LEFT OUTER JOIN category AS b ON a.catID = b.catID LEFT OUTER JOIN singer AS c ON a.singerID = c.singerID LEFT OUTER JOIN trash AS d ON a.sID = d.songid WHERE a.sStatus=3";
  101. $query .= " ORDER BY sID DESC , m_time DESC limit $offset,$limit";
  102. $result = mysql_query ($query);
  103. ?>
  104. <form method="post" action="" name="check_form">
  105. <br></br>
  106. <br></br>
  107. <h2> tất cả <?=$numrows?> bài nhạc đang được tạm xóa !</h2>
  108. <div style="clear: both;">
  109. <table class="tabledata" cellspacing="0" cellpadding="0" align="center" width="100%">
  110. <thead>
  111. <tr>
  112. <th>ID</th>
  113. <th>Link</th>
  114. <th>Tên</th>
  115. <th style="width: 120px;">Đăng bởi</th>
  116. <th>Thể loại</th>
  117. <th style="width: 120px;">Người Xóa</th>
  118. <th> do bị xóa</th>
  119. <th style="width: 80px;">Thao tác</th>
  120. <? if ($_SESSION['loginTitle'] == "admin" || $_SESSION['loginTitle'] == "checker") {?>
  121. <th>
  122. <input class="button" type="submit" onClick="return confirm('Này Thím ? Có chắc chắn muốn xóa những con hàng này không vậy ? Xóa là không khôi phục lại được đâu nhé !');" value="Xóa" name="DelSongSelect" ><br>
  123. <input type="checkbox" value="<?=$sID?>" name="element2" id="element2" onclick="toggleChecked(this)" />
  124. </th>
  125. <?}?>
  126. </tr>
  127. </thead>
  128. <tbody>
  129. <?
  130. $i = 0;
  131. while ($row=@mysql_fetch_array($result))
  132. {
  133. $i++;
  134. $sID = $row["sID"];
  135. $sName = $row["sName"];
  136. $tenbhkodau=CovertVn($sName);
  137. $sType = $row["sType"];
  138. $sView = $row["sView"];
  139. $sDownload = $row["sDownload"];
  140. $catID = $row["catID"];
  141. $catName = $row["catName"];
  142. $singerID = $row["singerID"];
  143. $singerName = $row["singerName"];
  144. $sStatus = $row["sStatus"];
  145. $lydo = $row["lydo"];
  146. $nguoixoa = $row["nguoixoa"];
  147. $id_user = $row["mID"];;
  148. $sHot = $row["sHot"];
  149. $sNew = $row["sNew"];
  150. $mIDaction = $row["mIDaction"];
  151. $query_css = "SELECT * FROM member WHERE mID='$id_user'";
  152. $result2 = mysql_query ($query_css);
  153. $numrows2=mysql_num_rows($result2);
  154. while ($row2=mysql_fetch_array($result2))
  155. {$username= $row2["mUsername"];}
  156. $sql_action = mysql_query("SELECT * FROM member WHERE mID = '$mIDaction'");
  157. $row_action = mysql_fetch_array($sql_action);
  158. ?>
  159. <tr id="trashbody<?=$sID?>">
  160. <td><b><?=$sID?></b></td>
  161. <td><img src="img/<?=$sType?>.gif" width="20" height="20"></td>
  162. <td><b><?=$sName?></b></td>
  163. <td><b><?=$username?></b></td>
  164. <td><b><?=$catName?></b></td>
  165. <td><b><font color="orange"><?=$row_action['mUsername']?></b></font></td>
  166. <td class="center"><font color="red"><?=$lydo?></font></td>
  167. <td>
  168. <a href="javascript: void(0)" class="movetrash" id="<?=$sID?>" title="Khôi phục"><img src="http://cdn2.iconfinder.com/data/icons/gnomeicontheme/24x24/stock/generic/stock_undelete.png" /></a>
  169. <a href="javascript: void(0)" class="deletetrash" id="<?=$sID?>" title="Xóa"><img width="16px" height="16px" src="img/Delete.png" /></a>
  170. </td>
  171. <? if ($_SESSION['loginTitle'] == "admin" || $_SESSION['loginTitle'] == "checker") {?>
  172. <td><label class="checkbox"><input type="checkbox" name="element2[]" value="<?=$sID?>" id="element2"></label></td>
  173. <?}?>
  174. </tr>
  175. <?}?>
  176. </tbody>
  177. </table> </form>
  178. <div class="pagination pagination-centered">
  179. <ul>
  180. <?
  181. if( $pages > 1 ) {
  182. printf("<div class='itempage'><a href=\"$qString&p=1\">Đầu</a></div>");
  183. if( $page <= 5 ) {
  184. $spage = 1;
  185. if($pages > 8 ) {
  186. $epage = 8;
  187. } else {
  188. $epage = $pages;
  189. }
  190. } else if ( $page <= $pages - 4 ) {
  191. $spage = $page - 4;
  192. $epage = $page + 4;
  193. } else {
  194. $spage = $pages - 8;
  195. $epage = $pages;
  196. }
  197. for ($i = $spage; $i <= $epage; $i++) {
  198. $newoffset = $limit*($i-1);
  199. if ($newoffset == $offset) {
  200. print " <div class='itempage active'>$i</a></div>";
  201. } else {
  202. print " <div class='itempage'><a href=\"$qString&p=$i\">$i</a></div>";
  203. }
  204. }
  205. echo "<div class='itempage'><a href=\"$qString&p=$epage\">Cuối</a></div>";
  206. }
  207. ?>
  208. <?
  209. echo "<br><center>Tổng số <strong>$numrows</strong> bài hát trong <strong>$pages</strong> trang.</center>";
  210. }
  211. }
  212. ?>
  213. </ul>
  214. </div>
  215. </div>
  216. </div>
  217. </div>
  218. </div>