include "../db/db_conn.php";
include "../counter/count.php";
header("Vary: User-Agent, Accept");
//$is_echo_preview_lib = 0; //1
$is_echo_coll_wish_lib = 0;
$is_echo_rclike_lib = 0;
$start = $_GET["start"];
$start = (int)$start;
$mode = $_GET["mode"];
$ix = $_GET["ix"];
if ($_COOKIE["logged_idx"]) {
$chk_time = time()-3600;
$like_chk = mysqli_fetch_array(mysqli_query($connect, "select count(*) from Album_photo_like where mem_idx='".$_COOKIE["logged_idx"]."' and like_time>'".$chk_time."'"));
$com_chk = mysqli_fetch_array(mysqli_query($connect, "select count(*) from Album_photo_com where mem_idx='".$_COOKIE["logged_idx"]."' and rtime>'".$chk_time."'"));
if ($like_chk[0] || $com_chk[0]) {
header("Cache-Control: no-store, no-cache, must-revalidate, max-age=0");
header("Cache-Control: post-check=0, pre-check=0", false);
header("Pragma: no-cache");
}
}
$mTitle = "Album Photos View";
if ($mode && $ix) {
if ($mode=="user") {
$tmet = mysqli_fetch_array(mysqli_query($connect, "select id,name,new_level from member where idx='".$ix."'"));
if ($tmet[0]) {
$mTitle = $tmet["name"]."'".((substr($tmet["name"], -1)=="s")?"":"s")." Album Photos View";
}
else {
header("HTTP/1.1 404 Not Found");
header("Location: ".$url_404);
exit;
}
}
else if ($mode=="album") {
$tmet = @mysqli_fetch_array(mysqli_query($connect, "select idx,band,album,a_type,release_date,band_idx,ab_str,thumb1,band_idx_2,band_idx_3,band_idx_4,band_idx_5,band_idx_6 from Album where idx='".$ix."'"));
$brow = mysqli_fetch_array(mysqli_query($connect, "select ab_str from Band where idx='".$tmet["band_idx"]."'"));
if ($tmet[0]) {
$mTitle = artist_name_text($tmet["band"],$tmet["band_idx"],$tmet["band_idx_2"],$tmet["band_idx_3"],$tmet["band_idx_4"],$tmet["band_idx_5"],$tmet["band_idx_6"])." - ".$tmet["album"]." Album Photos View";
}
else {
header("HTTP/1.1 404 Not Found");
header("Location: ".$url_404);
exit;
}
}
else if ($mode=="artist") {
$tmet = @mysqli_fetch_array(mysqli_query($connect, "select * from Band where idx='".$ix."'"));
if ($tmet[0]) {
$artist_idx = $ix;
$mTitle = $tmet["band"]." Album Photos View";
}
else {
header("HTTP/1.1 404 Not Found");
header("Location: ".$url_404);
exit;
}
}
else if ($mode=="user-artist") {
$tp = explode("-",$ix,2);
$tmet_1 = mysqli_fetch_array(mysqli_query($connect, "select id,name,new_level from member where idx='".$tp[0]."'"));
$tmet = mysqli_fetch_array(mysqli_query($connect, "select * from Band where idx='".$tp[1]."'"));
if ($tmet_1[0] && $tmet[0]) {
$artist_idx = $tp[1];
$mTitle = $tmet_1["name"]." / ".$tmet["band"]." - Album Photos View";
}
else {
header("HTTP/1.1 404 Not Found");
header("Location: ".$url_404);
exit;
}
$no_robots = 1; //noindex
}
else {
$mode = $ix = "";
}
}
$mTitle .= echo_page_str($start);
if ($mode=="artist" || $mode=="user-artist") {
$where_ai_sql = echo_where_ai_sql($artist_idx,$tmet["x_artist_1"],$tmet["x_artist_2"],$tmet["x_artist_3"]);
$tmp_result = mysqli_query($connect, "select idx from Album_mini where ".$where_ai_sql." order by idx asc");
$i = 0; $ai_album_photos = "";
while ($tmp_row = mysqli_fetch_array($tmp_result)) {
$ai_album_photos .= ($i==0) ? $tmp_row["idx"] : ",".$tmp_row["idx"];
$i++;
}
if (!$ai_album_photos) $ai_album_photos = "0";
}
$where_str = "";
if ($mode=="user" && $ix) {
$where_str = " where mem_idx='".$ix."'";
$post_str = "mode=user&ix=".$ix;
$album_photos_url = "/album-photo/user/".$ix."/";
}
else if ($mode=="album" && $ix) {
$where_str = " where album_idx='".$ix."'";
$post_str = "mode=album&ix=".$ix;
$album_photos_url = "/album-photo/album/".$ix."/";
}
else if ($mode=="artist" && $ix) {
$where_str = " where album_idx in (".$ai_album_photos.")";
$post_str = "mode=artist&ix=".$ix;
$album_photos_url = "/album-photo/artist/".$ix."/";
}
else if ($mode=="user-artist" && $ix) {
$tp = explode("-",$ix,2);
$where_str = " where mem_idx='".$tp[0]."' and album_idx in (".$ai_album_photos.")";
$post_str = "mode=user-artist&ix=".$ix;
$album_photos_url = "/album-photo/user-artist/".$ix."/";
}
if (!$album_photos_url) {
$album_photos_url = "/album-photo/all/";
}
$start_str = ($start && $start>1) ? "?start=".$start : "";
$canonical_url = "/album/photos.php".$start_str;
if ($post_str) {
$canonical_url .= ($start_str) ? "&" : "?";
$canonical_url .= $post_str;
}
$head_string = "
";
$row_2 = @mysqli_fetch_array(mysqli_query($connect, "select count(*) from Album_photo".$where_str));
if (!$start || $start<0) $start = 1;
$total = $row_2[0];
$scale = 40;
$page_scale = $default_page_scale;
$total_page = @ceil($total/$scale);
if ($total_page>0 && $start>$total_page) $start = $total_page;
$m = ($start-1)*$scale;
$result = mysqli_query($connect, "select * from Album_photo".$where_str." order by idx desc limit ".$m.",".$scale);
$chk_num = @mysqli_num_rows($result);
if ($isMobile) {
$no_top_ad = 1;
if ($chk_num>=3) $echo_matched_content = 1;
$top_include_file = "../mobile_top.php";
$main_include_file = "include/mobile_photos.php";
$bottom_echo_string = "
";
include "../mobile_site_layout.php";
}
else {
$top_include_file = "../top_new.php";
$main_include_file = "include/photos.php";
$side_include_file_1 = "../side/side_group_2.php";
if ($chk_num>=3) $side_include_file_2 = "../side/matched_content.php";
$bottom_echo_string = "
";
include "../site_layout_new.php";
}
include "../hidden2.php";
?>