www.gusucode.com > 仿51.com的php源码 1.1 > Music/MusicUpload.php

    <?php
include("../User/CheckLogined.php");
include("../include/dbclass.php");
include("../User/functions.php");
$dbc=new DbConn();
$uid=$_COOKIE["uid"];
$group=$_GET["group"];
$array = array(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,0,1,2,3,4,5,6,7,8,9); 
$key = array_rand($array,36);
for($i=$j;$i<36;$i++)
{
$str .= $array[$key[$i]];
}
//------------
$globalvars->set_vars();
$filesize_limit = explode(':', $globalvars->settings['Music_Max_upload']);
		$uploadmax_set = new functions();
		
		switch($filesize_limit[1])
		{
			case MB:
				$uploadmax = $uploadmax_set->mb_bytes($filesize_limit[0]);
			break;
			
			case KB:
				$uploadmax = $uploadmax_set->kb_bytes($filesize_limit[0]);
			break;
		}
if ($_COOKIE["vip"]=="0")
{
echo "<script>alert('只有VIP用户才能上传音乐。请升级为VIP');history.back();</script>";
exit();
}	
?>
<!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%2FMusicUpload.php";
	}
}catch(e){}
function showNewMessage(user){
	top.showNewMessage(user);
}

</script>
<script>
<!--
var preloadImgForUpload=new Image();
preloadImgForUpload.src="../i/music/loading.gif";
function chkForm(obj)
{
if(obj.file.value == "")
	{
		alert("请选择音乐文件");
		obj.file.focus();
		return false;
	}else{
		if(obj.file.value.search(/\.wma|\.ra|\.ram|\.rm|\.mid|\.rmi|\.mp3$/i) == -1)
		{
			alert("音乐文件格式不正确");
			obj.file.focus();
			return false;
		}
	}

	if(obj.music_title.value == "")
	{
		alert("必须填写音乐名称");
		obj.music_title.focus();
		unload_flag=false;
		return false;
	}
	if(obj.music_title.value.length >30)
	{
		alert("音乐名称字数不要超过30字");
		obj.music_title.focus();
		return false;
	}
	if(obj.author.value == "")
	{
		alert("必须填写作者名称");
		obj.author.focus();
		return false;
	}
	if(obj.author.value.length >15)
	{
		alert("作者名称字数不要超过15字");
		obj.author.focus();
		return false;
	}
	if(obj.memo.value.length>1000) {
		alert("歌词字数不要超过1000字");
		return false;
	}
	obj.upload_button.disabled = true;
	document.all('controlBar').style.display='none';
	document.all('uploading').innerHTML = '<img id=uploadimg src="" />';
	document.all('uploadimg').src=preloadImgForUpload.src;
	document.all('uploading').style.display='inline';
	setTimeout("document.all('uploadimg').src=preloadImgForUpload.src",1);
	return true;
}
//-->
</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" />&nbsp;秘密记事本</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 $Str_photo_class=$Str_photo_class.'"'.$row["GroupName"].'",';?>
<?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">&nbsp;&nbsp;<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="fenle">
<BR>
<style type="text/css">
#sector1 {
background-image:url(../images/sector1.gif);
background-repeat:no-repeat;
width:588px;
height:168px;
margin:20px 0;
text-align:left;
}
#s1a {
top:68px;
left:170px;
font-size:14px;
font-weight:bold;
position:relative;
text-align:left;
}
#sector2 {
background-image:url(../images/sector2.gif);
background-repeat:no-repeat;
width:588px;
height:387px;
margin:40px 0;
text-align:left;
}
#s2a {
width:540px;
text-align:left;
position:relative;
top:60px;
left:20px;
background-image:url(../images/bg1.gif);
background-repeat:no-repeat;
background-position:17px 110px;
}
#s2a input {
margin:3px 0;
}
#s2b {
width:480px;
margin:20px 0 0 67px;
color:#367DC6;
text-align:left;
line-height:20px;
}
#s2b a {
color:#000;
text-decoration:underline;
}
</style>
<form action="MusicSearch.php" onsubmit="return chkSearch(this)">
<input type=hidden name=act value=search>
<div id="sector1">
<div id="s1a">
<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"   />歌手
<span class="szxyb"><input name="submit_button" type="submit" class="btn" value="搜 索" />
</div>
</div>
</form>
<iframe name=upfile width=0 height=0></iframe>
<form name="form1" enctype="multipart/form-data" action="../User/MusicUploadNormal.php?user=<?php echo $uid;?>&key=<?php echo $str;  ?>&time=<?php echo time(); ?>" method="POST"  target="upfile"  onsubmit="return chkForm(this)">
<div id="sector2">
<div id="s2a">
<p >音乐文件: <input name="file" type="file" size="35" />(<font color=red style="text-valign:top"><b>大小请勿超过5M</b></font>)</p><input type="hidden" name="MAX_FILE_SIZE" value="<?php echo $uploadmax; ?>">
<p>音乐名称: <input type="text" name="music_title" /></p>
<p>歌手姓名:
<input type="text" name="author" /></p>
<p>是否您自己的翻唱作品:
<select name="myself" style="margin:3px 0;"><option value=0>否</option>
<option value=1>是</option>
</select> 音乐分类:<SELECT NAME="group_list" id="group_list"></SELECT></p>
<p></p>
<p>
<textarea name="memo" cols="70" rows="4" style="margin:10px 0 4px 67px;" onmouseover="this.selected" onfocus="clearText(this)">字数不要超过1000字</textarea>
</p>
<div id="controlBar">
<p><span class="szxyb">
<input name="upload_button" type="submit" class="btn" value="开始上传"  style="margin-left:67px;" /></span> <span class="szxyb">
<input name="Submit2" type="reset" class="btn" value="取消" onclick="self.location='MusicList.php';">
</span></p>
<div id="s2b">
<p style="color:red;">请上传您拥有合法版权的音乐</p>
<p>音乐格式必须为 WMA,RM,MID,RMI,MP3 中的一种!</p>
<p>推荐上传WMA格式,因为WMA格式播放速度快,而且只有WMA格式才能做主页的背景音乐。</p>
<p>如果您想把MP3格式转换为WMA格式,<a href="Converter.zip">可以点此下载转换工具</a> (输出位率建议选择96) </p>
</div>
</div>
<div id="uploading" style="display:none;padding-left:60px">
</div>
</div>
</div>
</form>

<script>
function chkSearch(obj) {
	if(obj.key.value=="") {
		alert("搜索关键词不能为空");
		return false;
	}
}
function clearText(obj){
	if(obj.value=="字数不要超过1000字"){
		obj.value="";
	}
}
</script>



<SCRIPT LANGUAGE="JavaScript">
<!--
var obj1 = document.getElementById("group_list");
//分类列表;
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;
}

if (document.all("group_list").options && "<?php echo $group; ?>" == ""){
	document.all("group_list").options[0].selected=true;
}else{
	document.all("group_list").value="<?php echo $group; ?>";
};
//-->
</SCRIPT>

</div>
</div>
</div>
<div id="bottom">
<div id="baidu" style="color:#a0a0a0;"><?php require("../foot.php"); ?></div>
</div>
<?php $dbc->free_result($result);?>
</body>
</html>