📄 song.php
字号:
<?php
/*
**此点歌插件简介了很多点歌版本. 加上 phpwind 本身的插件制作标准.采用模版输出 .除歌曲播放的 html 代码其他 php 完全由
**原作者不详:Ofstar到Phpwind的修改由alex来完成!!
*/
$wind_in="song";
$creditid="1";//接收到点歌的人增加的积分类型
$creditadd="5"; //每次增加多少积分
$usrl=5; //点播一首歌需要的金钱
$usrltb=10; //给指定的用户点歌需要的金钱
$howdays=30; //歌曲保留的天数。
$allowtoown=10;/*song*/
require("global.php");
require("header.php");
require_once(R_P."data/bbscache/level.php");
$msg_guide=headguide("点歌台");
if ($groupid=='guest')
{
$msg_info="状态:发生错误,您还没有登录";
include PrintEot('showmsg'); //用showmsg来输出错误
exit;
}
if($action!='put'){
require './require/bbscode.php';
if($winddb['hack']==1){
require './require/bbsxiu.php';//插件形象
if($winddb['hack']==1)
$usericon=getwindxiu($windid,"",140,226,$winddb['gender'],$winddb['hack']);
else{
if ($winddb["icon"]=="")
$usericon="<img src=\"$imgpath/face/0.gif\" width=%70>";
else
$usericon=showfacedesign($winddb["icon"]);
}
}
if ($ltitle[$groupid]=='djuser' || $windid==$manager){
$manage="---<a href=song_admin.php class=headurl><b>音乐DJ管理</b></a>";
}
//下面的功能是添加DJ管理员。以后添加
$sql="select m.username,u.* from pw_usergroups u left join pw_members m on u.gid=m.groupid where u.grouptitle='DJ管理员'";
$result=$db->query($sql);
$dj_admin="";
while($row=$db->fetch_array($result) && $row['username']!=""){
$dj_admin.="<a href=profile.php?action=show&username=".rawurlencode($row["username"]).">$row[username]</a><br>";
}
if(strlen(trim($dj_admin))==0){
$dj_admin.="<a href=profile.php?action=show&username=".rawurlencode($manager).">$manager</a><br>";
}
unset($sql,$result,$row);
}
if(empty($action)){
$songdetail=readover("data/songdata/songcache.htm");
include PrintEot('hack_song');footer();
}elseif($action=='user'){
$songlist=openfile("data/songdata/songdata.php");
$count=count($songlist);
for ($i=0; $i<$count; $i++) {
$detail=explode("|", trim($songlist[$i]));
$song.="<option value=\"$detail[1]\">$detail[2]</option>";
}
include PrintEot('hack_song');footer();
}elseif($action=='useradd'){
if(empty($zfy)){
$msg_info="请填写 '想说的话没说'";
include PrintEot('showmsg');
}
if(empty($putuser)){
$msg_info="请填写 '收 听 人'";
include PrintEot('showmsg');
}
if($putuser==$windid){
$msg_info="搞什么鬼,自恋狂,自己给自己点歌!!!!";
include PrintEot('showmsg');
}
$zfy=substrs($zfy,101);$zdwname=substrs($zdwname,51);
$zdwname=Char_cv(stripslashes($zdwname)); //$zdwname=safeconvert($zdwname);
$putuser=Char_cv(stripslashes($putuser)); //$putuser=safeconvert($putuser);
$zfy=char_cv(stripslashes($zfy)); //$zfy=safeconvert($zfy);
$zdw=Char_cv(stripslashes($zdw)); //$zdw=safeconvert($zdw);
$ssong=Char_cv(stripslashes($ssong)); //$ssong=safeconvert($ssong);
if($checkuser=='yes'){
$sql="select * from pw_members where username='$putuser'";
$num=$db->num_rows($db->query($sql));
if($num<=0){
$msg_info="论坛不存在此会员!返回检查!";
include PrintEot('showmsg');
}
}
$song_dat=openfile("data/songdata/song.php");
if($advshow==1){
$cost=$usrltb;
$songer=$zdw;$songname=$zdwname;
if(empty($zdwname)){
$msg_info="请填入歌曲名";
include PrintEot('showmsg');
}
} else {
$cost=$usrl;
$songer=$ssong;
$songlist=openfile("data/songdata/songdata.php");
for ($i=0; $i<count($songlist); $i++) {
$detail=explode("|", trim($songlist[$i]));
if($detail[1]==$ssong){$songname=$detail[2];break;}
}
}
if (!eregi("\.mid$",$songer) && !eregi("\.mp3$",$songer) && !eregi("\.avi$",$songer) && !eregi("\.asf$",$songer) && !eregi("\.wmv$",$songer) && !eregi("\.wma$",$songer) && !eregi("\.ra$",$songer) && !eregi("\.rm$",$songer) && !eregi("\.ram$",$songer) && !eregi("\.swf$",$songer)){
$msg_info="发生错误,指定歌曲必须为 MID、MP3、AVI、ASF、WMV、WMA、RA、RM、RAM、SWF 格式!";
include PrintEot('showmsg');
}
if($winddb["money"]<$allowtoown){
$msg_info="您的金钱不足,不能点歌!";
include PrintEot('showmsg');
}
$oldcount=count($song_dat);
$bctime=$howdays*86400;
$adddetail="<?die;?>|$windid|$putuser|$timestamp|$songer|$songname|$zfy|\n";
for ($i=0; $i<$oldcount; $i++) {
$detail=explode("|",$song_dat[$i]);
if($timestamp-$detail[3]>=$bctime)unset($song_dat[$i]);
}
$adddb=$adddetail.implode("",$song_dat);
writeover("data/songdata/song.php",$adddb);
$songarray=openfile("data/songdata/song.php");
$count=count($songarray);
$t_date=date("Ymd",$timestamp);
$flag=0;
for($i=0;$i<$count;$i++){
$detail=explode("|", trim($songarray[$i]));
$dates=date("Ymd",$detail[3]);
$dates2=$dates+$howdays;
if($t_date<= $dates2) {
$flag=1;
$timeds=date("Y-m-j g:i A",$detail[3]);
$songdetail.="<a href=javascript:popwin2('$detail[3]',410)><font color=blue>$detail[1]</font>点了一首<font color=green>《$detail[5]》</font>送给<font color=RED>$detail[2]</font>听,并想对 $detail[2] 说: <font color=RED>$detail[6]</font></a>($timeds)<br>";
}else {
if($flag!=1) $songdetail="最近$howdays 天内没有点歌信息!";
break;
}
}
writeover("data/songdata/songcache.htm",$songdetail);
if($checkuser=='yes'){
//给用户发短信
include("./require/msg.php");
$msg_content="你的朋友 <font color=blue>$windid</font> 点了一首《 $songname 》送给你听,并想对你说: ";
$msg_content.="<font color=blue>$zfy</font><br><br><a href=songs.php?action=song_st&dgno=$timestamp>";
$msg_content.="按这里听歌</a><br>-----------<br><font color=RED>注:听歌链接有效保留 $howdays 天</font>";
//$msg_content=Char_cv($msg_content);
$msg_title="点歌信息";
//$msg_title=Char_cv($msg_title);
$msg_content=autourl($msg_content);
$messageinfo=array($putuser,$windid,$msg_title,$timestamp,$msg_content,0);
writenewmsg($messageinfo);
//发短信结束
}
creditChange($putuser,$creditid,$creditadd);
dtchange($windid,'0','0',"-$cost");
refreshto("song.php","完成了点歌操作");
}
function creditChange($username,$cid,$credit){
global $db;
$user=$db->get_one("select uid from pw_members where username='$username'");
$uid=$user['uid'];
$query="select * from pw_membercredit where uid='$uid' and cid='$cid'";
$row=$db->get_one($query);
if($row){
$query="UPDATE pw_membercredit SET value=value+'$credit' where uid='$uid' and cid='$cid'";
}else{
$query="INSERT INTO pw_membercredit(uid,cid,value) VALUES('$uid','$cid','$credit')";
}
$db->query($query);
}
function autourl($message){
global $db_autoimg;
if($db_autoimg==1){
$message= preg_replace(array(
"/(?<=[^\]a-z0-9-=\"'\\/])((https?|ftp):\/\/|www\.)([a-z0-9\/\-_+=.~!%@?#%&;:$\\│]+\.gif)/i",
"/(?<=[^\]a-z0-9-=\"'\\/])((https?|ftp):\/\/|www\.)([a-z0-9\/\-_+=.~!%@?#%&;:$\\│]+\.jpg)/i"
), array(
"[img]\\1\\3[/img]",
"[img]\\1\\3[/img]"
), ' '.$message);
}
$message= preg_replace( array(
"/(?<=[^\]a-z0-9-=\"'\\/])((https?|ftp|gopher|news|telnet|mms|rtsp):\/\/|www\.)([a-z0-9\/\-_+=.~!%@?#%&;:$\\│]+)/i",
"/(?<=[^\]a-z0-9\/\-_.~?=:.])([_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,4}))/i"
), array(
"[url]\\1\\3[/url]",
"[email]\\0[/email]"
), ' '.$message);
return $message;
}
?>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -