www.gusucode.com > 仿51.com的php源码 1.1 > Music/MusicList.php
<?php include("../User/CheckLogined.php"); include("../include/dbclass.php"); require_once "../include/page.php"; $dbc=new DbConn(); $group=$_GET["group"]; $page=(int)$_GET["page"]; $deferentparameter="&group=".$group; $maxline = 19; $uid=$_COOKIE["uid"]; if($_GET["action"]=="midbg") { $id=$_GET["id"]; $title=$_GET["title"]; //echo $id; //exit(); $upsql="update userdata set midbg='$id',midtitle='$title' where User_Account='$uid'"; $dbc->Execute($upsql); if($id==NULL) { echo "<script>alert('已成功取消背景音乐!');location.href='/User/MusicHomepageBg.php';</script>"; } else { echo "<script>alert('设置成功,你现在的背景音乐为[ $title ]!');location.href='/User/MusicHomepageBg.php';</script>"; } } //设置背景 if($_GET["action"]=="bg") { if($_COOKIE["vip"]>0){ $id=$_GET["id"]; $sql="select Music_Url,Music_Title from music where id='$id'"; $rs=$dbc->getRs($sql); $midbg=$rs["Music_Url"]; $title=$rs["Music_Title"]; $upsql="update userdata set midbg='$midbg',midtitle='$title' where User_Account='$uid'"; $dbc->Execute($upsql); echo "<script>alert('背景音乐设置成功!');history.back();</script>"; }else { echo "<script>alert('你还不是VIP以上成员');location.href='/help/free-vip.php';</script>"; } } //上下 if ($_GET["action"]=="swap") {$id=$_GET["id"]; $swap=$_GET["swap"]; $page=$_GET["page"]; $group=$_GET["group"]; $sql="update musicuser set MyOrder=MyOrder+'$swap' where id='$id'"; $dbc->Execute($sql); header("Location:MusicList.php?group=$group"); } //移动 if ($_GET["action"]=="moveMusic") { $group_list=$_POST["group_list"]; $id=$_POST["id"]; $refer=$_POST["refer"]; $sql="update musicuser set Music_Group='$group_list' where Music_id='$id' and User_Name='$uid'"; $dbc->Execute($sql); header("Location:MusicList.php$refer"); } //删除 if($_GET["action"]=="del") { $id=$_GET["id"]; $page=$_GET["page"]; $group=$_GET["group"]; //删除与ID有关的所有评论 $sql="delete from MusicCommentToMe where MusicComment_CommentObjId='$id'"; $dbc->Execute($sql); //删除所有收藏 $sql1="delete from musicuser where Music_id='$id'"; $dbc->Execute($sql1); //删除原文件 $sql2="select Music_Path from music where id='$id'"; $Rs=$dbc->getRs($sql2); if(file_exists("../User/".$Rs["Music_Path"])) { unlink("../User/".$Rs["Music_Path"]); } //删除MUSIC中的数据库 $sql3="delete from music where id='$id'"; $dbc->Execute($sql3); header("Location:MusicList.php?group=$group&page=$page"); } //删除收藏 if ($_GET["action"]=="del_fav") { $id=$_GET["id"]; $page=$_GET["page"]; $group=$_GET["group"]; //删除评论 $sql="delete from MusicCommentToMe where MusicComment_CommentObjId='$id' and MusicComment_UserName='$uid'"; $dbc->Execute($sql); $sql1="delete from musicuser where Music_id='$id' and User_Name='$uid'"; $dbc->Execute($sql1); header("Location:MusicList.php?group=$group&page=$page"); } ?> <?php if($group==null){ $sqlf="select GroupName from MusicGroup where User_Account='$uid' order by GroupOrder desc limit 0,1"; $rs=$dbc->getRs($sqlf); if($rs!=null) { $g=$rs["GroupName"]; header("Location:MusicList.php?group=$g"); } }?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=gb2312" /> <title>村委会档案管理中心 -- 音乐</title> <link href="../images/User_Main.css" rel="stylesheet" type="text/css" /> <script> try{ if(top!=window){ document.domain ="www.wu-liao.com"; }else{ top.location.href="/webin.php?refer=%2FMusic%2FMusicList.php"; } }catch(e){} function showNewMessage(user){ top.showNewMessage(user); } </script> <script> /*********Js Function Begin*********/ //非VIP使用受限功能时弹出free-vip.php function AppUpgrateVip(msg) { <?php if($_COOKIE["vip"]=="0"){?> var isVip=false; <?php }else{?> var isVip = true; <?php }?> if (!isVip) { alert(msg); window.open('http://www.wu-liao.com/help/free-vip.php', 'VIP'); return false; } else { return true; } } function AppDeleteMusic(id,action,from, msg) { AppGetObject('del_id').value = id; AppGetObject('action').value = action; AppGetObject('from').value = from; AppGetObject('group').value = "<?php echo $group; ?>"; if(haveSecondPassword) { AppOpenPOP('二级密码输入框', 'del_div', 250, 160); } else { if (confirm(msg)) { self.location.href='MusicList.php?action=' + action + '&id='+id+'&page=<?php echo $page; ?>&group=<?php echo $group; ?>'; } } } function AppGetObject(id) { if(document.getElementById) { return document.getElementById(id); } else if(document.all) { return document.all[id]; } else if(document.layers) { return document.layers[id]; } } function AppOpenPOP(title, obj_name, w, h) { var elm_popBackground = document.getElementById("popBackgroundLayer"); var elm_popFrameWork = document.getElementById("popFrameWorkLayer"); elm_popBackground.style.height = document.body.scrollHeight; elm_popBackground.style.width = document.body.scrollWidth; elm_popFrameWork.style.width = w; elm_popFrameWork.style.height = h; srcContentObject = document.getElementById(obj_name); if(srcContentObject) { popContentObject2.innerHTML = srcContentObject.innerHTML; }else{ alert(obj_name + '未找到'); } elm_popBackground.style.display = "block"; elm_popFrameWork.style.display = "block"; AppMoveLayer("popFrameWorkLayer"); } function AppMoveLayer(layerId) { var layer = document.getElementById(layerId); if (layer) { layer.style.position = "absolute"; var menu = document.getElementById("menu"); var topPos = 0; if (window.screenTop >= 0) { topPos = -Math.abs(window.screenTop) + (window.screen.height - layer.offsetHeight) / 2; } else { topPos = Math.abs(window.screenTop) + (window.screen.height - layer.offsetHeight) / 2; } if (menu && ((topPos + layer.offsetHeight / 2) < menu.offsetTop)) { topPos = menu.offsetTop - layer.offsetHeight / 2 + 20; } layer.style.top = topPos + "px"; layer.style.left = (document.documentElement.scrollLeft + (document.documentElement.clientWidth - document.getElementById(layerId).offsetWidth) / 2) + "px"; } } function AppMusicSwap(fav_id, swap){ if(swap<0) { var step = window.prompt("向后跳几位", 1); } else var step = window.prompt("向前跳几位", 1); if (step) { if(AppIsNum(step)){ if (step == 0){ alert('数字不能为 0 ');return; } location.href="MusicList.php?action=swap&id="+fav_id+"&swap="+step*swap+"&page=<?php echo $page; ?>&group=<?php echo $group; ?>"; }else{ alert('输入的不是数字');return; } } } function AppIsNum(num){ if (parseFloat(num) == num) return true; else return false; } function AppGetCookie(name) //获得Cookie的原始值 { var arg = name + "="; var alen = arg.length; var clen = document.cookie.length; var i = 0; while (i < clen) { var j = i + alen; if (document.cookie.substring(i, j) == arg) return AppGetCookieVal(j); i = document.cookie.indexOf(" ", i) + 1; if (i == 0) break; } return null; } function AppGetCookieVal(offset) //获得Cookie解码后的值 { var endstr = document.cookie.indexOf (";", offset); if (endstr == -1) endstr = document.cookie.length; return unescape(document.cookie.substring(offset, endstr)); } function AppSetCookie(name, value) //设定Cookie值 { var expdate = new Date(); var argv = AppSetCookie.arguments; var argc = AppSetCookie.arguments.length; var expires = (argc > 2) ? argv[2] : null; var path = (argc > 3) ? argv[3] : null; var domain = (argc > 4) ? argv[4] : null; var secure = (argc > 5) ? argv[5] : false; if(expires!=null) expdate.setTime(expdate.getTime() + ( expires * 1000 )) document.cookie = name + "=" + escape (value) +((expires == null) ? "" : ("; expires="+ expdate.toGMTString())) +((path == null) ? "" : ("; path=" + path)) +((domain == null) ? "" : ("; domain=" + domain)) +((secure == true) ? "; secure" : "") delete value } function AppDelCookieMusic(name) //?Cookie { var exp = new Date(); exp.setTime (exp.getTime() - 1); var cval = AppGetCookie (name); AppSetCookie(name, '', exp,'/','www.wu-liao.com'); AppSetCookie(name, '', exp,'/Music','www.wu-liao.com'); } function AppClosePOP() { var elm_popBackground = document.getElementById("popBackgroundLayer"); var elm_popFrameWork = document.getElementById("popFrameWorkLayer"); popContentObject2 = document.getElementById("popContentLayer"); srcContentObject.innerHTML = popContentObject2.innerHTML; popContentObject2.innerHTML = ''; elm_popBackground.style.display = "none"; elm_popFrameWork.style.display = "none"; } function AppCreatePOP() { var layerContainer = '<div id="popBackgroundLayer"></div><div id="popFrameWorkLayer" style="width:100%"><div id="popContentLayer" align="center"></div></div>'; document.write(layerContainer); popContentObject2 = document.getElementById("popContentLayer"); } /*********Js Function End*********/ var haveSecondPassword = false; </script> <script language="javascript" src="../js/msg_ajax.js"></script> </head> <body> <div id="top"> <div id="logo"><a href="/User/Main.php"></a></div> <div id="topr"> <div id="exit"><?php require("../menu.php"); ?> <div id="menu"> <div class="m2"> <div class="mg"><a href="/User/Main.php">用户管理中心</a></div> <div class="mh"><a href="/Diary/DiaryList.php">日记文集</a></div> <div class="ma"><a href="/Photo/PhotoList.php">相册</a></div> <div class="ma"><a href="/Image/ImageList.php">图库</a></div> <div class="mb" id="do1"><a href="/Music/MusicList.php">音乐</a></div> <div class="mc"><div id="ms"><a href="/Memo/MemoList.php"><img src="../images/suo2.gif" width="10" height="12" /> 秘密记事本</a></div> </div> <div class="me"><a href="/Fav/FavList.php">网址收藏夹</a></div> <div class="mf"><a href="/Addr/AddrList.php">通讯录</a></div> </div> </div> </div> <div id="nav"> <div id="navt"></div> </div> <div id="mjx"></div> <div id="main"> <div id="left"> <div id="leph"> <div class="phff"> <div class="phtt"> 音乐收藏分类</div> <?php $sql1="select * from MusicGroup where User_Account='$uid' order by GroupOrder desc"; $result=$dbc->query($sql1); while ($row=@mysql_fetch_array($result)) { ?> <?php if ($row["GroupName"]==$group){?> <div class="phl1"><div class="phz "><a href="MusicList.php?group=<?php echo $row["GroupName"]; ?>" title="<?php echo $row["GroupName"]; ?>"><?php echo $row["GroupName"]; ?></a></div></div><?php }else{?><div class="phl2 "><a href="MusicList.php?group=<?php echo $row["GroupName"]; ?>" title="<?php echo $row["GroupName"]; ?>"><?php echo $row["GroupName"]; ?></a></div><?php }?> <?php }?> <div class=phl2 style='font-size:12px;color:red'><div class="phz" ><a href='http://my.51.com/FixGroup.php' target=_blank></a></div></div><div class="mxle"><a href="MusicGroup.php">分类管理</a></div><div class="mxle"><a href="MusicCommentToMe.php">评论管理</a></div><div class="mxle"><a href="MusicBg.php">背景设置</a></div><div class="mxle"><a href="MusicNewUpload.php">最新上传</a></div><!--<div class="phl2"> <a href="http://bbs.51.com/gourl.php?refer=/tip_list.php?type=122" target="_blank">翻唱专区</a></div>--></div> </div> </div> <div id="right"> <div id="a4n"> <div class="anphg"> <div id="txss"> <div class="a4"><img width=0 height=14><img src="../images/jdsc.gif" width="12" height="12" /> <a href="MusicUpload.php?group=<?php echo $group; ?>" onclick="javascrip: return AppUpgrateVip('只有VIP用户才能上传音乐。请升级为VIP'); ">上传音乐</a></div> <form action="MusicSearch.php" onsubmit="return chkSearch(this)"> <input type=hidden name=act value=search> <div STYLE="text-align:right;font-size:14px;font-weight:bold"> <img src='../images/search.jpg'>音乐搜索: <input name="key" type="text" class="text" size="20" value='' /> <input type="radio" name="type" value="1" checked /> 歌名 <input type="radio" name="type" value="2" /> 歌手 <input name="submit_button" type="submit" class="btn" value="搜 索" /> </div> </form> <div align=center><table><tr><td width=80% align=center><font color=red>注意:输入的字越少,搜索的结果越多!</font></td><td width=40></td></tr></table></div> </div> </div> <script> function chkSearch(obj) { var pattern=/^( )+$/i; if(obj.key.value=="") { alert("搜索关键词不能为空"); return false; } else if(pattern.test(obj.key.value)) { alert("搜索关键词不能为空"); return false; } } </script> </div> <div id="fenle"> <Table width="580px" border="0" cellpadding="2" cellspacing="0" class="tb"> <TR class="tbti"><TD width="18" style="font-weight:bold;text-align:left;"> </TD><TD style="font-weight:bold;text-align:left;" width="35%">音乐名称</TD><TD>格式</TD><TD>来源</TD><TD>修改</TD><TD>移动</TD><TD>删除</TD><TD>设为背景音乐</TD><TD nowrap>铃声</TD><TD>排序</TD></TR> <?php if ($group=="") { $sql="select * from musicuser where User_Name='$uid' order by Get_Date desc,MyOrder desc"; } else { $sql="select * from musicuser where User_Name='$uid' and Music_Group='$group' order by Get_Date desc,MyOrder desc"; } $news = $dbc->getGopageRs($sql,$maxline); //echo "$sql"; $gopage = new GoPage($dbc->tpages,$dbc->total);//建立翻页程序 $backurl = "MusicList.php?".$dbc->getParameter(); if ($dbc->num_rows==0) {?> </TR> <TD colspan="10">提示:暂无纪录</TD> </TR> <?php } for($i=0;$i<$dbc->num_rows;$i++) { $Music_id=$news[$i]["Music_id"]; $sql_id="select * from music where id='$Music_id'"; $query_id=$dbc->query($sql_id); $rs=mysql_fetch_array($query_id); ?> <TR><TD style="text-align:left;"><input type="checkbox" name="cb" value="<?php echo $Music_id; ?>" /></TD><TD style="text-align:left;word-break:break-all;word-wrap:break-word;"><a target=_blank href=../home/PlayMusic.php?id=<?php echo $Music_id; ?>&user=<?php echo $news[$i]["User_Name"];?>&from=><?php echo $rs["Music_Title"];?></a><input type="hidden" name="musicTitle" value="<?php echo $rs["Music_Title"];?>"></TD> <TD> <?php echo $rs["Style"];?> </TD> <TD> <?php if ($news[$i]["BornFrom"]==1){ ?>上传<?php }else{?>收藏<?php }?></TD> <TD><?php if ($news[$i]["BornFrom"]==1){ ?><a href="MusicEdit.php?id=<?php echo $rs["id"];?>&group=<?php echo $news[$i]["Music_Group"]; ?>&page=<?php echo $page; ?>">修改</a><?php }else{?>无权<?php }?></TD> <TD><a href="#" onclick="AppJsMoveMusic(<?php echo $rs["id"];?>)">移动</a></TD> <TD><?php if($news[$i]["BornFrom"]==1){?><a href="#" onclick="AppDeleteMusic(<?php echo $rs["id"];?>, 'del','', '确认删除?');return false;" >删除</a><?php }else{?><a href="#" onclick="AppDeleteMusic(<?php echo $rs["id"];?>, 'del_fav','', '确认删除此收藏?');return false;">删除</a><?php }?></TD> <TD><?php if($rs["Style"]=="wma"){?> <a title='设置成主页背景音乐' onclick="return AppUpgrateVip('只有VIP用户才能将该音乐设为背景音乐。请升级为VIP') && confirm('使用其他用户的音乐做为背景,如果用户删除了这首音乐,您的背景音乐将无法播放!确定要设置这首音乐为背景吗?')" href='?id=<?php echo $rs["id"];?>&action=bg'>设置</a> <?php }else{?> 无权 <?php }?></TD> <TD><a href='http://c.9588.com/?userid=100021&songname=%E6%9C%88%E4%BA%AE%E4%B9%8B%E4%B8%8A' target="_blank" title="下载到手机"><img src='../images/lss.gif' border=0></a></TD> <TD> <a href="#" onclick="AppMusicSwap(<?php echo $rs["id"];?>, 1)">↑</a><a href="#" onclick="AppMusicSwap(<?php echo $rs["id"];?>, -1)">↓</a> </TD> </TR> <?php }?> </Table> <table width="580" height="40" border="0" cellpadding="0" cellspacing="0"> <tr> <td><input name="acb" id="acb" type="button" class="btn" value="全选" onclick="checkAll()" /> <input name="clearAll" type="button" class="btn" value="全否" onclick="clearAll()" /> <input name="addMusicList" type="button" class="btn" value="加入播放列表" onclick="addPlayList()" /> <select name="playlist" id="playlist" style="width:150px"> </select> <input name="deleteMusic" type="button" class="btn" value="删除" onclick="deleteMusic()" /> <input name="clearPlayList" type="button" class="btn" value="清空列表" onclick="clearPlayList()" /> <input name="loopPlay" id="loopPlay" type="button" class="btn" value="连续播放" onclick="loopPlay()" /> </td> </tr> </table> <script src="../js/playlist.js"></script> <BR/> <div class="fenye"> <?=$gopage->style(3)?> </div> <BR/> <!-- 二级密码提示内容 --> <div id="del_div" style="display: none"> <form name="confirmForm" action="?page=" method="POST"> <input name="id" id="del_id" value="" type="hidden"> <input name="action" id="action" value="" type="hidden"> <input name="group" id="group" value="" type="hidden"> <input name="from" id="action" value="" type="hidden"> <div id="SecondPasswordLayer"> <div> <table width="100%" border="0" cellpadding="0" cellspacing="0"> <tr> <td width="3" height="3"><img src="../images/czs.gif" width="3" height="3" /></td> <td background="../images//css.gif"></td> <td width="3" height="3"><img src="../images//cys.gif" width="3" height="3" /></td> </tr> <tr> <td background="../images//czz.gif"></td> <td bgcolor="#ebebeb"><table width="100%" border="0" align="center" cellpadding="2" cellspacing="0"> <tr> <td align="right"><a href="#" onclick="AppClosePOP()"><img src="../images//close.gif" width="16" height="14" border="0" /></a></td> </tr> <tr> <td><table width="98%" border="0" align="center" cellpadding="0" cellspacing="0"> <tr> <td> <div style="width:300px;height:150px"> <fieldset align="center" valign="middle" style="height:85%;width:85%;border:2px groove #ffffff"> <legend align="left" style="color:#000000;font-weight:bold">此操作需要二级密码才能执行</legend> <table width="179" border="0" align="center"> <tr> <td height="10" colspan="2"></td> </tr> <tr> <td width="85" height="30" align="left">输入二级密码:</td> <td width="84" align="left"><input name="second_pass" type="password" size="10" /></td> </tr> <tr> <td height="25" colspan="2"></td> </tr> <tr> <td height="20" colspan="2" align="center"><input type="submit" name="Submit" value="确定" style="width:70px;background:#d4d0c8;border:2px outset #FFFFFF" onclick="" /> <input type="button" name="Cancel" value="取消" style="width:70px;background:#d4d0c8;border:2px outset #FFFFFF" onclick="AppClosePOP()" /></td> </tr> </table> </fieldset> </div> </td> </tr> </table></td> </tr> </table></td> <td background="../images//cyy.gif"></td> </tr> <tr> <td width="3" height="3"><img src="../images//czx.gif" width="3" height="3" /></td> <td background="../images//cxx.gif"></td> <td width="3" height="3"><img src="../images/cyx.gif" width="3" height="3" /></td> </tr> </table> </div> </div> <script language="javascript"> window.onscroll = function() { AppMoveLayer("popFrameWorkLayer"); } </script> </form> </div> <!-- 二级密码提示内容:结束 --> <!-- 相片移动提示内容 --> <div id="move_div" style="display: none"> <div id="PhotoMoveLayer"> <div> <table width="85%" border="0" cellpadding="0" cellspacing="0"> <tr> <td width="3" height="3"><img src="../images/czs.gif" width="3" height="3" /></td> <td background="../images/css.gif"></td> <td width="3" height="3"><img src="../images/cys.gif" width="3" height="3" /></td> </tr> <tr> <td background="../images/czz.gif"></td> <td bgcolor="#ebebeb"><table width="100%" border="0" align="center" cellpadding="2" cellspacing="0"> <tr> <td align="right"><a href="#" onclick="AppClosePOP()"><img src="../images/close.gif" width="16" height="14" border="0" /></a></td> </tr> <tr> <td><table width="98%" border="0" align="center" cellpadding="0" cellspacing="0"> <tr> <td> <div style="width:300px;height:130px"> <fieldset align="center" valign="middle" style="height:85%;width:94%;border:2px groove #ffffff"> <legend align="left" style="color:#000000;font-weight:bold">转移到其他分类</legend> <TABLE> <FORM NAME="form1" METHOD="POST" ACTION="?action=moveMusic"> <TR> <TD style="padding-top:15px">转移到分类:</TD> <TD style="padding-top:15px"> <SELECT NAME="group_list" id="group_list"> </SELECT> </TD> </TR> <TR> <TD STYLE="height:15px" COLSPAN="2"></TD> </TR> <TR> <TD colspan="2" align="center"> <INPUT TYPE="submit" value="确定" style="width:70px;background:#d4d0c8;border:2px outset #FFFFFF"> <INPUT TYPE="button" value="取消" style="width:70px;background:#d4d0c8;border:2px outset #FFFFFF" onclick="AppClosePOP()"> <INPUT TYPE="hidden" name="id" id="id" value=""> <INPUT TYPE="hidden" name="refer" id="refer" value="?group=<?php echo $group; ?>&page=<?php echo $page; ?>"> </TD> </TR> </FORM> </TABLE> </fieldset> </div></td> </tr> <tr> <td style="height:5px"></td> </tr> </table></td> </tr> </table></td> <td background="../images/cyy.gif"></td> </tr> <tr> <td width="3" height="3"><img src="../images/czx.gif" width="3" height="3" /></td> <td background="../images/cxx.gif"></td> <td width="3" height="3"><img src="../images/cyx.gif" width="3" height="3" /></td> </tr> </table> </div> </div> </div> <!-- 相片移动提示内容_结束 --> <SCRIPT LANGUAGE="JavaScript"> <!-- var obj1 = document.getElementById("group_list"); //分类列表; <?php $sql1="select * from MusicGroup where User_Account='$uid' order by GroupOrder desc"; $result=$dbc->query($sql1); while ($row=@mysql_fetch_array($result)) { if ($group !=$row["GroupName"]) { ?> <?php $Str_photo_class=$Str_photo_class.'"'.$row["GroupName"].'",';?> <?php } }?> var photo_class = new Array(<?php echo substr($Str_photo_class,0,strlen($Str_photo_class)-1); ?>); for(var i = 0; i<photo_class.length ; i++) { var option1 = new Option(); option1.text = photo_class[i]; option1.value = photo_class[i]; obj1.options[obj1.options.length] = option1; } //--> </SCRIPT> <script> AppCreatePOP(); var haveSecondPassword = false; window.onscroll = function() { AppMoveLayer("popFrameWorkLayer"); } </script> </div> </div> </div> <div id="bottom"> <div id="baidu" style="color:#a0a0a0;"><?php require("../foot.php"); ?></div> </div> </body> </html>