<div id="bgblogdetails">
	<div id="boblogdetails" 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']);
						$bodb = mysqli_query($koneksi, "SELECT * FROM cmas_konten WHERE konten_id='$id'");
						$bodt = mysqli_fetch_array($bodb);
					?>
					<a href="./">Beranda</a> &nbsp;&#10095;&nbsp; <a href="blogs">Blogs</a> &nbsp;&#10095;&nbsp; <?php echo $bodt['konten_judul']; ?>
				</div>
			</div>
		</div>
		
		<div id="boblogdetailsleft">
			<?php 
				date_default_timezone_set("Asia/Jakarta");
				include "../libs/functiondb.php";
				
				$id = mysqli_real_escape_string($koneksi, $_GET['id']);
				$bodb = mysqli_query($koneksi, "SELECT * FROM cmas_konten WHERE konten_id='$id'");
				$bodt = mysqli_fetch_array($bodb);
				$konten_id = $bodt['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', '$bodt[konten_id]', '$bodt[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='$bodt[konten_id]'");
				}
				
				$mdb = mysqli_query($koneksi, "SELECT * FROM cmas_metadata");
				$mdt = mysqli_fetch_array($mdb);
				
				if ($bodt['konten_imageid'] == 0) {
			?>
				<div id="blogdetailsfull">
					<div class="blogdetailssos">
						<div class="<?php echo $mdt['metadata_addthisclass']; ?>"></div>
					</div>
					<div class="blogdetailstit">
						<h1><?php echo $bodt['konten_judul']; ?></h1>
					</div>
					<div class="blogdetailsdet">
						<?php echo tanggal_indo(date('Y-m-d', strtotime($bodt['konten_date'])), true); ?> &bull; <?php echo $bodt['konten_author']; ?>
					</div>
					<div class="blogdetailsdes">
						<?php echo $bodt['konten_desc']; ?>
					</div>
				</div>
			<?php } else { ?>
				<div id="blogdetailstop">
					<div class="blogdetailssos">
						<div class="<?php echo $mdt['metadata_addthisclass']; ?>"></div>
					</div>
					<div class="blogdetailstit">
						<h1><?php echo $bodt['konten_judul']; ?></h1>
					</div>
					<div class="blogdetailsdet">
						<?php echo tanggal_indo(date('Y-m-d', strtotime($bodt['konten_date'])), true); ?> &bull; <?php echo $bodt['konten_author']; ?>
					</div>
				</div>
				<div id="blogdetailsmid" class="clearfix">
					<div class="blogdetailsimg">
						<img src="assets/images/konten/<?php echo $bodt['konten_image']; ?>" alt="<?php echo $bodt['konten_judul']; ?>" title="<?php echo $bodt['konten_judul']; ?>">
					</div>
				</div>
				<div id="blogdetailsbot">
					<div class="blogdetailsdes">
						<?php echo $bodt['konten_desc']; ?>
					</div>
				</div>
			<?php } ?>

			<?php 
				include "../libs/functiongaleri.php";
				$gdb = mysqli_query($koneksi, "SELECT * FROM cmas_kontenimg WHERE konten_id='$bodt[konten_id]'");
				$find = mysqli_num_rows($gdb);
				
				if ($find == 0) {} else {
			?>
				<div id="blogdetailsgaleribox" class="clearfix">	
					<?php while($gdt = mysqli_fetch_array($gdb)) { ?>
						<div id="blogdetailsgaleri">
							<div class="blogdetailsgaleriimg">
								<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']; ?>">
								</a>
							</div>
							<div class="blogdetailsgaleritit">
								<?php echo $gdt['kontenimg_judul']; ?>
							</div>
						</div>
					<?php } ?>
				</div>
			<?php } ?>
		</div>
		
		<div id="boblogdetailsrite">
			<div id="blogdetailslist" class="clearfix">
				<div class="blogdetailslisttit">
					BLOGS BAYU TERBARU
				</div>
				<div class="blogdetailslistdes">
					<?php
						date_default_timezone_set("Asia/Jakarta");
						include "../libs/functiondb.php";
						$bodb = mysqli_query($koneksi, "SELECT * FROM cmas_konten WHERE kontenkat_id='2' ORDER BY RAND() DESC LIMIT 2");
						while($bodt = mysqli_fetch_array($bodb)) {
						
						if ($bodt['konten_imageid'] == 0) {
					?>
							<div id="blogdetailslistdesbox">
								<div class="blogdetailslistdestit">
									<a href="2<?php echo $bodt['konten_id']; ?>-<?php echo $bodt['konten_seo']; ?>">
										<?php echo $bodt['konten_judul']; ?>
									</a>
								</div>
								<div class="blogdetailslistdesdes">
									<?php echo $bodt['konten_sdesc']; ?>
								</div>
								<div class="blogdetailslistdesdet">
									<?php echo tanggal_indo(date('Y-m-d', strtotime($bodt['postdated'])), true); ?>
								</div>
							</div>
						<?php } else { ?>
							<div id="blogdetailslistdesbox">
								<div id="blogdetailslistdesboxtop">
									<div class="blogdetailslistdesimg">
										<img src="assets/images/konten/<?php echo $bodt['konten_image']; ?>" alt="<?php echo $bodt['konten_judul']; ?>" title="<?php echo $bodt['konten_judul']; ?>">
									</div>
								</div>
								
								<div id="blogdetailslistdesboxbot">
									<div class="blogdetailslistdestit">
										<a href="2<?php echo $bodt['konten_id']; ?>-<?php echo $bodt['konten_seo']; ?>">
											<?php echo $bodt['konten_judul']; ?>
										</a>
									</div>
									<div class="blogdetailslistdesdes">
										<?php echo $bodt['konten_sdesc']; ?>...
									</div>
									<div class="blogdetailslistdesdet">
										<?php echo tanggal_indo(date('Y-m-d', strtotime($bodt['konten_date'])), true); ?> &bull; <?php echo $bodt['konten_author']; ?>
									</div>
								</div>
							</div>
						<?php } ?>
					<?php } ?>
				</div>
			</div>
		</div>
	</div>
</div>