//error_reporting(E_ALL);
//ini_set("display_errors", "1");
include "../db/db_conn.php";
include "../counter/count.php";
include "../db/band_album_admin_idx.php";
header("Vary: User-Agent, Accept");
$is_echo_preview_lib = 0;
if ($memberLevel==21) $is_echo_coll_wish_lib = 0;
//$is_echo_rclike_lib = 0; //1
//$is_view_ad = 0;
$idx = $_GET["idx"];
$rs = mysqli_fetch_array(mysqli_query($connect, "select * from Album where idx='".$idx."'"));
$band_info = mysqli_fetch_array(mysqli_query($connect, "select * from Band where idx='".$rs['band_idx']."'"));
if (!$rs[0]) {
header("HTTP/1.1 404 Not Found");
header("Location: ".$url_404);
exit;
}
$band_url = echo_band_url($rs['band_idx'],$band_info['ab_str']);
$album_url = echo_album_url($rs["idx"],$rs["ab_str"]);
//$reviews_url = "/reviews/".$rs["ab_str"]."-".$idx;
//$comments_url = "/comments/".$rs["ab_str"]."-".$idx;
if (!preg_match("/^\/album\/([^\/]+)-([0-9]+)\/?$/",$_SERVER['REQUEST_URI'])) {
header("HTTP/1.1 301 Moved Permanently");
header("Location: ".$protocol_site_domain.$album_url);
exit;
}
$band_idx = $rs["band_idx"];
$is_collabo = 0;
$collaboration = "";
if (!$rs["no_collabo"] && ($rs["band_idx_2"] || $rs["band_idx_3"] || $rs["band_idx_4"] || $rs["band_idx_5"] || $rs["band_idx_6"])) {
$band_name_str = $band_info["band"];
for ($i=2 ; $i<7 ; $i++) {
if ($rs["band_idx_".$i]) {
$tmp = mysqli_fetch_array(mysqli_query($connect, "select band,ab_str from Band where idx='".$rs["band_idx_".$i]."'"));
if ($tmp[0]) {
$is_collabo = 1;
$band_name_str .= " / ".$tmp["band"];
${"band_idx_".$i} = $rs["band_idx_".$i];
${"band_name_".$i} = $tmp["band"];
${"band_ab_str_".$i} = $tmp["ab_str"];
}
}
}
if ($rs["a_type"]!="split") {
$collaboration = " [collaboration]";
}
}
else {
$band_name_str = $rs["band"];
}
$mTitle = $band_name_str." - ".$rs["album"];
$mTitle .= ($rs["a_type"]!="album") ? " [".$_AMTYPE[$rs["a_type"]]."]" : "";
$h1c = $mTitle;
## 광고 차단 Band인지 확인
/*
$chk_band_idx = $band_idx;
$chk_band_name = $band_info["band"];
$chk_band_genre = $band_info["style"];
include "../etc/no_ads_band_check.php";
*/
## 광고 차단 Album인지 확인
/*
$chk_album_idx = $idx;
$chk_album_genre = $rs["style"];
include "../etc/no_ads_album_check.php";
*/
## 광고 차단 Page인지 확인
include "../etc/no_ads_page_check.php";
## DESCRIPTION
/*
$description = $rs["album"]." is ";
$description .= ($rs["a_type"]=="ep") ? "an " : "a ";
$description .= $_AMTYPE_D[$rs["a_type"]]." by ".$band_name_str.". ";
*/
$a_year_album = substr($rs["release_date"],0,4);
$description = $rs["album"]." (".$a_year_album.")";
$description .= ($rs["a_type"]!="album") ? " [".$_AMTYPE[$rs["a_type"]]."]" : "";
$description .= " by ".$band_name_str.". ";
/*
if ($rs["rating"]) {
if ($rs['total_review']>1) $tmp = ", ".$rs['total_review']." reviews";
else if ($rs['total_review']==1) $tmp = ", ".$rs['total_review']." review";
else $tmp = "";
$description .= "Rating: ".$rs['rating']."/100 (".$rs['total_vote']." rating".(($rs['total_vote']>1)?"s":"").$tmp."). ";
}
*/
if ($rs["total_vote"]>=$default_votes) {
$rank = mysqli_fetch_array(mysqli_query($connect, "select a_year,rank_all,rank_year from Album_rank where aidx='".$rs["idx"]."'"));
if ($rank["rank_all"]) {
//$description .= "Ranked: #".$rank["rank_year"]." for ".$rank["a_year"].", #".$rank["rank_all"]." all-time. ";
//$description .= "Ranked: #".$rank["rank_all"]." all-time. ";
}
}
if ($rs["label"]) $description .= "Labels: ".$rs['label'].". ";
if ($rs["style"]) {
$tmp = explode(", ",$rs["style"]);
for ($i=0 ; $i",$rs["song"]);
$k=0;
for ($i=0 ; $i0) $description .= ". ";
$j=0;
if ($rs["member"]) {
$tmp = explode("
",$rs["member"]);
for ($i=0 ; $i: ",$tmp[$i],2);
if ($tmp2[0] && $tmp2[1]) {
if ($j==0) $description .= "Members: ".trim(strip_tags($tmp2[0]));
else $description .= ", ".trim(strip_tags($tmp2[0]));
$j++;
}
if ($j==6) break;
}
}
if ($j==6) $description .= ".. ";
else if ($j>0) $description .= ". ";
$description = trim($description);
if (strlen($description)<80) $description = "";
$meta_description = $description;
if ($rs["big_cover"]=="y") $og_image = "/album-cover-artwork/".$rs["image"];
else $og_image = "/album/cover/".$rs["image"];
$head_string = "
";
if ($description) {
$head_string .=
"
";
}
$fb_data_href = $protocol_site_domain.$album_url;
if ($rs["band_idx"]!="16489" && !$is_collabo) {
$xsql_1 = $xsql_2 = $xsql_3 = "";
if ($band_info["x_artist_1"]) $xsql_1 = " or band_idx='".$band_info["x_artist_1"]."' or band_idx_2='".$band_info["x_artist_1"]."' or band_idx_3='".$band_info["x_artist_1"]."' or band_idx_4='".$band_info["x_artist_1"]."' or band_idx_5='".$band_info["x_artist_1"]."' or band_idx_6='".$band_info["x_artist_1"]."'";
if ($band_info["x_artist_2"]) $xsql_2 = " or band_idx='".$band_info["x_artist_2"]."' or band_idx_2='".$band_info["x_artist_2"]."' or band_idx_3='".$band_info["x_artist_2"]."' or band_idx_4='".$band_info["x_artist_2"]."' or band_idx_5='".$band_info["x_artist_2"]."' or band_idx_6='".$band_info["x_artist_2"]."'";
if ($band_info["x_artist_3"]) $xsql_3 = " or band_idx='".$band_info["x_artist_3"]."' or band_idx_2='".$band_info["x_artist_3"]."' or band_idx_3='".$band_info["x_artist_3"]."' or band_idx_4='".$band_info["x_artist_3"]."' or band_idx_5='".$band_info["x_artist_3"]."' or band_idx_6='".$band_info["x_artist_3"]."'";
$where_sql = "(band_idx='".$rs["band_idx"]."' or band_idx_2='".$rs["band_idx"]."' or band_idx_3='".$rs["band_idx"]."' or band_idx_4='".$rs["band_idx"]."' or band_idx_5='".$rs["band_idx"]."' or band_idx_6='".$rs["band_idx"]."'".$xsql_1.$xsql_2.$xsql_3.")";
$result_album = mysqli_query($connect, "select idx,band,album,a_type,release_date,rating,total_vote,total_review,band_idx,ab_str,lyrics_num,band_idx_2,band_idx_3,band_idx_4,band_idx_5,band_idx_6,no_collabo from Album where ".$where_sql." and a_type in ('album','ep','live') order by release_date asc");
$echo_discog_num = mysqli_num_rows($result_album);
}
$certif = mysqli_fetch_array(mysqli_query($connect, "select * from certifications where aidx='".$idx."'"));
$list_item_result = mysqli_query($connect, "select list_idx from list_item where album_idx='".$idx."' and is_public='y' order by idx desc");
$list_item_num = mysqli_num_rows($list_item_result);
$album_videos_result = mysqli_query($connect, "select idx,track_full,track,ab_str,yb_id from videos where aidx='".$idx."' order by published desc, idx desc limit 0,4");
$album_videos_num = mysqli_num_rows($album_videos_result);
$review_num = $rs["total_review"];
$comment_num = $rs["total_vote"]-$rs["total_review"];
$chk_num = 0;
if ($rs["member"]) $chk_num += 3;
if ($rs["guest_session"]) $chk_num += 3;
if ($rs["other_staff"]) $chk_num += 3;
if ($rs["etc"]) $chk_num += 3;
if (isset($certif[0]) && $certif[0]!="") $chk_num += 1;
$chk_num += ($album_videos_num>4) ? 4 : $album_videos_num;
if ($list_item_num>0) $chk_num += $list_item_num*1;
$chk_num += ($review_num<4) ? $review_num*8 : 4*8;
$chk_num += ($comment_num<20) ? $comment_num*2 : 20*2;
if ($echo_discog_num>0) $chk_num += $echo_discog_num*0.8;
$v_type_arr = array("mu"=>"Music Video","li"=>"Live Video","ly"=>"Lyric Video","au"=>"Audio");
if ($isMobile) {
$no_top_ad = 1;
$is_ad_1_echo = 0;
if ($chk_num>=10) {
$is_ad_1_echo = 1;
if ($chk_num>=13) $echo_matched_content = 1;
}
$head_include_file = "";
$top_include_file = "../mobile_top.php";
$main_include_file = "include/mobile_album_view.php";
include "../mobile_site_layout.php";
}
else {
$top_include_file = "../top_new.php";
if ($chk_num>=10) {
$side_include_file_1 = "../side/kingdom_new.php";
$side_include_file_2 = "../side/ad_300_600_album.php";
$side_include_file_3 = "../side/community_new.php";
$side_include_file_4 = "../side/info_new.php";
$side_include_file_5 = "../side/album_of_the_year_2.php";
if ($chk_num>=13) $side_include_file_6 = "../side/matched_content.php";
}
else {
$side_include_file_1 = "../side/kingdom_new.php";
$side_include_file_2 = "../side/community_new.php";
$side_include_file_3 = "../side/info_new.php";
$side_include_file_4 = "../side/album_of_the_year_2.php";
}
$main_include_file = "include/album_view.php";
include "../site_layout_new.php";
}
include "../hidden2.php";
//Weekly Chart - album hits
if ($memberLevel<21) {
$tmp = mysqli_fetch_array(mysqli_query($connect, "select * from wc_album_hits where album_idx='".$idx."' and start_time<=".$nowTime." and end_time>=".$nowTime));
$hidx = $tmp["idx"];
if (!$tmp[0]) {
$start_time = 1674140400; //2023-01-20 금요일 오전 12:00:00
while (1) {
$start_time += (86400 * 7);
$end_time = $start_time + (86400 * 7) - 1;
if ($start_time<=$nowTime && $end_time>=$nowTime) break;
}
mysqli_query($connect, "insert into wc_album_hits (album_idx,start_time,end_time,hits) values (".$idx.",".$start_time.",".$end_time.",0)");
$hidx = mysqli_insert_id($connect);
}
$tmp = mysqli_fetch_array(mysqli_query($connect, "select * from wc_album_hits_id where hidx='".$hidx."' and mem_idx=".$_COOKIE["logged_idx"]));
if (!$tmp[0]) {
mysqli_query($connect, "insert into wc_album_hits_id (hidx,mem_idx) values (".$hidx.",".$_COOKIE["logged_idx"].")");
mysqli_query($connect, "update wc_album_hits set hits=hits+1 where idx=".$hidx);
}
}
?>