<?
	$mId = $_POST["mId"];	
	require_once('link.php');
	mysql_select_db($database,$connect);

	if( ($_FILES['bPhoto']['error'][0] == UPLOAD_ERR_OK )) //如果有上傳,即處理這張照片
	{ 
		$userfile_1 = $_FILES['bPhoto']['tmp_name'][0]; //上傳圖檔(暫存位置)
        $upfile_1 = "./pic/band_pic/".$_FILES['bPhoto']['name'][0]; //檔案上傳後的位置+檔案名稱
          
        if( (move_uploaded_file($_FILES['bPhoto']['tmp_name'][0], $upfile_1)))
        {	
        	echo "UPLOAD DONE  " . $_FILES['bPhoto']['name'][0] ;
        }else{
			echo "UPLOAD FAIL 101 " ;
		}
	}else{
		echo "UPLOAD FAIL 102 " ;
	}
	$upfile_2 = "/pic/band_pic/".$_FILES['bPhoto']['name'][0];
	
	if(	$upfile_2 == '/pic/band_pic/')
	{
		$content = addslashes(nl2br($content));
		mysql_query('SET NAMES utf8');
		$query1 = "INSERT INTO Band VALUES ('$bName','$year-$month-$day','$bInfo',NULL)";
		mysql_query($query1,$connect);
	}
	else
	{
		$content = addslashes(nl2br($content));
		mysql_query('SET NAMES utf8');
		$query1 = "INSERT INTO Band VALUES ('$bName','$year-$month-$day','$bInfo','$upfile_2')";
		mysql_query($query1,$connect);
	}
	
	
	$query3 = "INSERT INTO `AddModify1` VALUES ('$mId','$bName','$seq',NOW())"; 
	mysql_query($query3,$connect);
	
	FOREACH($_POST['name'] as $i=>$value)
	{
		$query2 = "INSERT INTO Bmember VALUES ('$bName','$i','$name[$i]','$talnet[$i]')"; 
		mysql_query($query2,$connect);
	}

	
	echo "<Script language='javascript'>";
	echo "var r=confirm('是否繼續編輯此樂團發行的專輯?');";
	echo "if(r==true)";
	echo "location.href='album_num.php?bName=".$bName."';";
	echo "if(r==false)";
	echo "location.href='b_show.php?bName=".$bName."';";
	echo "</script>";
	
?>