<div id="bgpages">
	<div id="bopages" class="clearfix"> 
		
		<div id="bgbreadcumb">
			<div id="bobreadcumb">
				<div class="bobreadcumbtit">
					<?php
						date_default_timezone_set("Asia/Jakarta");
						include "../libs/functiondb.php";
						
						$id = mysqli_real_escape_string($koneksi, $_GET['id']);
						$badb = mysqli_query($koneksi, "SELECT * FROM cmas_konten WHERE konten_seo='$id'");
						$badt = mysqli_fetch_array($badb);
					?>
					<a href="./">Beranda</a> &nbsp;&#10095;&nbsp; <a href="content-<?php echo $badt['konten_seo']; ?>"><?php echo $badt['kontenkat_judul']; ?></a> &nbsp;&#10095;&nbsp; <?php echo $badt['konten_judul']; ?>
				</div>
			</div>
		</div>

		<div id="bopagesleft">
			<div id="pageslist" class="clearfix">
				<div class="pageslistdes">
					<?php
						$id = mysqli_real_escape_string($koneksi, $_GET['id']);
						$badb = mysqli_query($koneksi, "SELECT * FROM cmas_konten WHERE konten_seo='$id'");
						$badt = mysqli_fetch_array($badb);
						
						if ($badt['kontenkat_id'] == "1") {
							$bandb = mysqli_query($koneksi, "SELECT * FROM cmas_konten WHERE kontenkat_id='1' AND konten_status='Aktif' ORDER BY konten_order ASC");
						} elseif ($badt['kontenkat_id'] == "3") {
							$bandb = mysqli_query($koneksi, "SELECT * FROM cmas_konten WHERE kontenkat_id='3' AND konten_status='Aktif' ORDER BY konten_order ASC");
						} elseif ($badt['kontenkat_id'] == "4") {
							$bandb = mysqli_query($koneksi, "SELECT * FROM cmas_konten WHERE kontenkat_id='4' AND konten_status='Aktif' ORDER BY konten_order ASC");
						}
						while($bandt = mysqli_fetch_array($bandb)) {
					?>
						<a href="content-<?php echo $bandt['konten_seo']; ?>">
							<div class="pageslistdestit">
								<?php echo $bandt['konten_judul']; ?>
							</div>
						</a>
					<?php } ?>
				</div>
			</div>
		</div>
		
		<div id="bopagesrite">
			<?php 
				date_default_timezone_set("Asia/Jakarta");
				include "../libs/functiondb.php";
				
				$id = mysqli_real_escape_string($koneksi, $_GET['id']);
				$ardb = mysqli_query($koneksi, "SELECT * FROM cmas_konten WHERE konten_seo='$id'");
				$ardt = mysqli_fetch_array($ardb);
				$konten_id = $ardt['konten_id'];
				
				$loghits_ip		= $_SERVER['REMOTE_ADDR'];
				$loghits_date	= date("Y-m-d H:i:s");
				$loghits_agent	= $_SERVER['HTTP_USER_AGENT'];
				
				$khdb = mysqli_query($koneksi, "SELECT * FROM cmas_loghits WHERE loghits_ip='$loghits_ip' AND contentid='$konten_id'");
				$find = mysqli_num_rows($khdb);
				
				if ($find == 0) {
					mysqli_query($koneksi, "INSERT INTO cmas_loghits (loghits_id, loghits_ip, loghits_hits, loghits_date, loghits_agent, contentid, contenttitle) VALUES(NULL, '$loghits_ip', '1', '$loghits_date', '$loghits_agent', '$ardt[konten_id]', '$ardt[konten_judul]')");
				} else {
					mysqli_query($koneksi, "UPDATE cmas_loghits SET loghits_hits = loghits_hits+1, loghits_date = '$loghits_date', loghits_agent='$loghits_agent' WHERE loghits_ip='$loghits_ip' AND contentid='$ardt[konten_id]'");
				}
				
				$mdb = mysqli_query($koneksi, "SELECT * FROM cmas_metadata");
				$mdt = mysqli_fetch_array($mdb);
				
				if ($ardt['konten_imageid'] == 0) {
			?>
				<div id="pagesfull">
					<div class="pagessos">
						<div class="<?php echo $mdt['metadata_addthisclass']; ?>"></div>
					</div>
					<div class="pagestit">
						<h1><?php echo $ardt['konten_judul']; ?></h1>
					</div>
					<div class="pagesdes">
						<?php echo $ardt['konten_desc']; ?>
					</div>
				</div>
			<?php } else { ?>
				<div id="pagestop">
					<div class="pagessos">
						<div class="<?php echo $mdt['metadata_addthisclass']; ?>"></div>
					</div>
					<div class="pagestit">
						<h1><?php echo $ardt['konten_judul']; ?></h1>
					</div>
					<div class="pagesimg">
						<img src="assets/images/konten/<?php echo $ardt['konten_image']; ?>" alt="<?php echo $ardt['konten_judul']; ?>" title="<?php echo $ardt['konten_judul']; ?>">
					</div>
				</div>
				<div id="pagesbot">
					<div class="pagesdes">
						<?php echo $ardt['konten_desc']; ?>
					</div>
				</div>
			<?php } ?>

			<?php 
				include "../libs/functiongaleri.php";
				$gdb = mysqli_query($koneksi, "SELECT * FROM cmas_kontenimg WHERE konten_id='$ardt[konten_id]'");
				$find = mysqli_num_rows($gdb);
				
				if ($find == 0) {} else {
			?>
				<div id="pagesgaleribox" class="clearfix">	
					<?php while($gdt = mysqli_fetch_array($gdb)) { ?>
						<div id="pagesgaleri">
							<div class="pagesgaleriimg">
								<a class="fancybox" href="assets/images/konten/img/<?php echo $gdt['kontenimg_image']; ?>" title="<?php echo $gdt['kontenimg_judul']; ?>" data-fancybox-group="gallery">
									<img src="assets/images/konten/img/<?php echo $gdt['kontenimg_image']; ?>" alt="<?php echo $gdt['kontenimg_judul']; ?>" title="<?php echo $gdt['kontenimg_judul']; ?>">
								</a>
							</div>
							<div class="pagesgaleritit">
								<?php echo $gdt['kontenimg_judul']; ?>
							</div>
						</div>
					<?php } ?>
				</div>
			<?php } ?>
		</div>
	</div>
</div>