/web nhacdj.vn php/code/AdminCP/php/songtrash.php
PHP | 226 lines | 218 code | 8 blank | 0 comment | 43 complexity | 2492c5c6b99750f07e88f1b6ba07d4ee MD5 | raw file
- <script type="text/javascript">
- $(document).ready(function()
- {
- $('.movetrash').live("click",function()
- {
- var ID = $(this).attr("id");
- var dataString = 'songID='+ ID;
- if(confirm("Bạn muốn khôi phục bài hát này về trạng thái chờ duyệt ?"))
- {
- $.ajax({
- type: "POST",
- url: "ajax/Move_Song_Trash.php",
- data: dataString,
- cache: false,
- success: function(html){
- $("#trashbody"+ID).fadeOut(200);
- }
- });
- }
- return false;
- });
- });
- </script>
- <? if ($_SESSION['loginTitle'] == "admin" || $_SESSION['loginTitle'] == "checker") {?>
- <script type="text/javascript">
- $(document).ready(function()
- {
- $('.deletetrash').live("click",function()
- {
- var ID = $(this).attr("id");
- var dataString = 'songID='+ ID;
- if(confirm("Bạn muốn xóa bài hát này khỏi Cơ sở dữ liệu ?"))
- {
- $.ajax({
- type: "POST",
- url: "ajax/Delete_Song.php",
- data: dataString,
- cache: false,
- success: function(html){
- $("#trashbody"+ID).fadeOut(200);
- }
- });
- }
- return false;
- });
- });
- </script>
- <?}?>
- <?php
- $page = $_GET['p'];
- $getErr = $_GET['getErr'];
- if(preg_match("/\D/",$page)) {
- echo("<br> <p align=center><font class=\"err\">NUMBER FORMAT EXCEPTION!</font></p>");
- } else {
- $limit=40;
- $kw = khongdau( $_GET["kw"] );
- if ( empty($kw) ) {
- $kw = "";
- }
- if (empty($page)) {
- $offset=0;
- }
- else {
- $offset = ($page-1)*$limit;
- }
- if($getErr == "on") {
- $qString = "?v=songtrash&getErr=on";
- } else {
- $qString = "?v=songtrash&kw=$kw";
- }
- if($_POST['DelSongSelect']) {
- $action='';
- if($_POST['element2']=='') {
-
- echo '<script>alert(\'Thím phải chọn ít nhất 1 bài hát chứ !\')</script>';
- $action=true;
- }
- if($action=='') {
- mysql_query("DELETE FROM song WHERE sID in (".implode(",",$_POST['element2']).")");
- mysql_query("DELETE FROM comment WHERE sID in (".implode(",",$_POST['element2']).")");
- echo '<script>alert(\'Thôi xong CMNR ! Đã xóa những bài Thím vừa chọn !\')</script>';
- }
- }
- ?>
- <form action="He-thong.html" name="xoaFrm" method="POST">
- <input type="hidden" name="act" value="removetrashSong" />
- <input type="hidden" name="back" value="AdminCP.html<?=$qString?>&p=<?=$page?>" />
- <input type="hidden" name="ID" />
- </form>
- <?
- $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";
- $numresults = mysql_query ($querythumuc);
- $numrows=mysql_num_rows($numresults);
- $pages=intval($numrows/$limit);
- if ($pages < ($numrows/$limit)){
- $pages=($pages + 1);
- }
- if($page > $pages || $numrows == "0") {
- echo("<h3 align='center'><br></br><br></br><br></br>Không có bài nhạc nào tạm xóa !</h3>");
- } else {
- $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";
- $query .= " ORDER BY sID DESC , m_time DESC limit $offset,$limit";
- $result = mysql_query ($query);
- ?>
- <form method="post" action="" name="check_form">
- <br></br>
- <br></br>
- <h2>Có tất cả <?=$numrows?> bài nhạc đang được tạm xóa !</h2>
- <div style="clear: both;">
- <table class="tabledata" cellspacing="0" cellpadding="0" align="center" width="100%">
- <thead>
- <tr>
- <th>ID</th>
- <th>Link</th>
- <th>Tên</th>
- <th style="width: 120px;">Đăng bởi</th>
- <th>Thể loại</th>
- <th style="width: 120px;">Người Xóa</th>
- <th>Lý do bị xóa</th>
- <th style="width: 80px;">Thao tác</th>
- <? if ($_SESSION['loginTitle'] == "admin" || $_SESSION['loginTitle'] == "checker") {?>
- <th>
- <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>
- <input type="checkbox" value="<?=$sID?>" name="element2" id="element2" onclick="toggleChecked(this)" />
- </th>
- <?}?>
- </tr>
- </thead>
- <tbody>
- <?
- $i = 0;
- while ($row=@mysql_fetch_array($result))
- {
- $i++;
- $sID = $row["sID"];
- $sName = $row["sName"];
- $tenbhkodau=CovertVn($sName);
- $sType = $row["sType"];
- $sView = $row["sView"];
- $sDownload = $row["sDownload"];
- $catID = $row["catID"];
- $catName = $row["catName"];
- $singerID = $row["singerID"];
- $singerName = $row["singerName"];
- $sStatus = $row["sStatus"];
- $lydo = $row["lydo"];
- $nguoixoa = $row["nguoixoa"];
- $id_user = $row["mID"];;
- $sHot = $row["sHot"];
- $sNew = $row["sNew"];
- $mIDaction = $row["mIDaction"];
- $query_css = "SELECT * FROM member WHERE mID='$id_user'";
- $result2 = mysql_query ($query_css);
- $numrows2=mysql_num_rows($result2);
- while ($row2=mysql_fetch_array($result2))
- {$username= $row2["mUsername"];}
- $sql_action = mysql_query("SELECT * FROM member WHERE mID = '$mIDaction'");
- $row_action = mysql_fetch_array($sql_action);
- ?>
- <tr id="trashbody<?=$sID?>">
- <td><b><?=$sID?></b></td>
- <td><img src="img/<?=$sType?>.gif" width="20" height="20"></td>
- <td><b><?=$sName?></b></td>
- <td><b><?=$username?></b></td>
- <td><b><?=$catName?></b></td>
- <td><b><font color="orange"><?=$row_action['mUsername']?></b></font></td>
- <td class="center"><font color="red"><?=$lydo?></font></td>
- <td>
- <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>
- <a href="javascript: void(0)" class="deletetrash" id="<?=$sID?>" title="Xóa"><img width="16px" height="16px" src="img/Delete.png" /></a>
- </td>
- <? if ($_SESSION['loginTitle'] == "admin" || $_SESSION['loginTitle'] == "checker") {?>
- <td><label class="checkbox"><input type="checkbox" name="element2[]" value="<?=$sID?>" id="element2"></label></td>
- <?}?>
- </tr>
- <?}?>
- </tbody>
- </table> </form>
- <div class="pagination pagination-centered">
- <ul>
- <?
- if( $pages > 1 ) {
- printf("<div class='itempage'><a href=\"$qString&p=1\">Đầu</a></div>");
- if( $page <= 5 ) {
- $spage = 1;
- if($pages > 8 ) {
- $epage = 8;
- } else {
- $epage = $pages;
- }
- } else if ( $page <= $pages - 4 ) {
- $spage = $page - 4;
- $epage = $page + 4;
- } else {
- $spage = $pages - 8;
- $epage = $pages;
- }
- for ($i = $spage; $i <= $epage; $i++) {
- $newoffset = $limit*($i-1);
-
- if ($newoffset == $offset) {
- print " <div class='itempage active'>$i</a></div>";
- } else {
- print " <div class='itempage'><a href=\"$qString&p=$i\">$i</a></div>";
- }
- }
- echo "<div class='itempage'><a href=\"$qString&p=$epage\">Cuối</a></div>";
- }
- ?>
- <?
- echo "<br><center>Tổng số <strong>$numrows</strong> bài hát trong <strong>$pages</strong> trang.</center>";
- }
- }
- ?>
- </ul>
- </div>
- </div>
- </div>
- </div>
- </div>