

						<!-- BEGIN .main-page -->
						<div class="main-page full-width">

							<!-- BEGIN .content-block -->
							<div class="content-block main">
								
								<div class="block">
									<div class="block-title">
										<a href="index.html" class="right">Back to homepage</a>
										<h2><?php 
												echo "<form action='indeks-berita.html' method='POST'>";
												echo "Lihat Indeks Tangggal &nbsp; &nbsp; &nbsp;<select name='tanggal' class='select'>";
												if (isset($_POST['filter'])){
													echo "<option value='$_POST[tanggal]' selected>$_POST[tanggal]</option>";
												}else{
													echo "<option value='' selected> Pilih Tanggal </option>";
												}
													for($n=1; $n<=31; $n++){
														echo "<option value='$n'>$n</option>";
													}
														echo "</select>
														<select name='bulan' class='select'> ";
														$bln = array('','Januari','Februari','Maret','April','Mei','Juni','Juli','Agustus','September','Oktober','November','Desember');
												if (isset($_POST['filter'])){	
													$b = $_POST['bulan'];
													echo "<option value='$_POST[bulan]' selected>$bln[$b]</option>";
												}else{
													echo "<option value='' selected> Pilih Bulan </option>";
												}												
													for($n=1; $n<=12; $n++){
														echo "<option value='$n'>$bln[$n]</option>";
													}
														echo "</select>
														<select name='tahun' class='select'> ";
												if (isset($_POST['filter'])){	
													echo "<option value='$_POST[tahun]' selected>$_POST[tahun]</option>";
												}else{
													echo "<option value='' selected> Pilih Tahun </option>";
												}
													$year = date("Y");
													for($n=2008; $n<=$year; $n++){ 
														echo "<option value='$n'>$n</option>";
													} 											
														echo "</select>
														<input style='padding:0px 6px 0px 6px;' type='submit' name='filter' value='Lihat Indeks'>";
											  echo "</form>";
											?>
										</h2>
									</div>
									<div style='width:97%' class="block-content archive">

									<?php  
									$warna = array("red","blue","red","purple","orange","black","yellow","red","blue","green");
											$col = 5;
											$terkini=mysql_query("SELECT * FROM kategori");
											$ada = mysql_num_rows($terkini);
										if ($ada > 0) {
												  echo "<table><tr>";
												  $cnt = 0;
												
											while ($t=mysql_fetch_array($terkini)){
												if (isset($_POST['filter'])){
													$bulan = strlen($_POST['bulan']);
													$tanggal = strlen($_POST['tanggal']);
																	
													if ($bulan <= 1){
														$bulann = '0'.$_POST['bulan'];
													}else{
														$bulann = $_POST['bulan'];
													}
																	
													if ($tanggal <= 1){
														$tanggall = '0'.$_POST['tanggal'];
													}else{
														$tanggall = $_POST['tanggal'];
													}
													$fil = $_POST['tahun'].'-'.$bulann.'-'.$tanggall;
													$jumlah = mysql_query("SELECT * FROM berita where id_kategori='$t[id_kategori]' AND tanggal='$fil'");
													$total = mysql_num_rows($jumlah);
												}else{
													$jumlah = mysql_query("SELECT * FROM berita where id_kategori='$t[id_kategori]'");
													$total = mysql_num_rows($jumlah);
												}
												if ($total >= 1){	
													
													if ($cnt >= $col) {
													  echo "</tr><tr>";
													  $cnt = 0;
													}
													$cnt++;

												echo "<td style='padding:5px; width:230px'> <div class='block'>
																<h2 style='color:$warna[$cnt]' class='list-title'>$t[nama_kategori]</h2>
																
																<ul class='article-list'>";
																if (isset($_POST['filter'])){
																	$bulan = strlen($_POST['bulan']);
																	$tanggal = strlen($_POST['tanggal']);
																	
																	if ($bulan <= 1){
																		$bulann = '0'.$_POST['bulan'];
																	}else{
																		$bulann = $_POST['bulan'];
																	}
																	
																	if ($tanggal <= 1){
																		$tanggall = '0'.$_POST['tanggal'];
																	}else{
																		$tanggall = $_POST['tanggal'];
																	}
																	$fil = $_POST['tahun'].'-'.$bulann.'-'.$tanggall;
																	$sql=mysql_query("SELECT * FROM berita where id_kategori='$t[id_kategori]' AND tanggal='$fil' order by id_berita DESC LIMIT 5");
																	while ($r=mysql_fetch_array($sql)){
																		$tgll = tgl_indo($r['tanggal']);
																		$tglpake = substr($tgll,0,6); 
																		$judul = substr($r['judul'],0,40); 
																		$komen1 = "SELECT * FROM komentar WHERE id_berita = '".$r['id_berita']."'";
																		$komentar1 = mysql_query($komen1);
																		$total_komentar1 = mysql_num_rows($komentar1);
																		echo "<li><a title='$r[judul]' href='berita-$r[judul_seo].html'>$fil $judul,..</a><a href='berita-$r[judul_seo].html' class='h-comment'>$total_komentar1</a><span class='meta-date'>$tglpake</span></li>";
																	}
																}else{
																	$now = date("Y-m-d");
																	$sql=mysql_query("SELECT * FROM berita where id_kategori='$t[id_kategori]' order by id_berita DESC LIMIT 5");
																	while ($r=mysql_fetch_array($sql)){
																		$tgll = tgl_indo($r['tanggal']);
																		$tglpake = substr($tgll,0,6); 
																		$judul = substr($r['judul'],0,40); 
																		$komen1 = "SELECT * FROM komentar WHERE id_berita = '".$r['id_berita']."'";
																		$komentar1 = mysql_query($komen1);
																		$total_komentar1 = mysql_num_rows($komentar1);
																		echo "<li><a title='$r[judul]' href='berita-$r[judul_seo].html'>$judul,..</a><a href='berita-$r[judul_seo].html' class='h-comment'>$total_komentar1</a><span class='meta-date'>$tglpake</span></li>";
																	}
																}
																
																echo "</ul>
																<a href='kategori-$t[id_kategori]-$t[kategori_seo].html' class='more'>Read More</a>
															</div>
													</td>";
												}else{

												}
											}
												  echo "</tr></table>";
												  
										}
									?>
									</div>
								</div>

							<!-- END .content-block -->
							</div>

						<!-- END .main-page -->
						</div>


