<?php
if (basename($_SERVER['SCRIPT_FILENAME']) == basename(__FILE__)){
echo "<p align=center><br><br><br><br><br><br><font size=\"6\" color=\"#FF0000\">ILLEGAL ACCESS !!";
echo "<meta http-equiv=\"refresh\" content=\"2; url=../index.php\">";
exit();} 
?>

 <!-- Content Header (Page header) -->
    <section class="content-header">
      <h1>
        News
      </h1>
      <ol class="breadcrumb">
        <li class="breadcrumb-item"><a href="#"><i class="fa fa-dashboard"></i> Home</a></li>
        <li class="breadcrumb-item active">News</li>
      </ol>
    </section>


    <section class="content">



 <div class="row">

          <div class="col-lg-12 col-12">
            <div class="box">
				<div class="box-header with-border">
              		<h5 class="box-title">Recent posts</h5>
				</div>
				<div class="box-body p-0">
				  <div class="media-list media-list-hover media-list-divided">
				
                <?php

$db->select("id_berita, id_user, judul, isi_berita, gambar, tanggal, counter, published", "berita", "published=1", "id_berita desc LIMIT 5");

	while($row = $db->fetch_row()) {
	$judul = $row[2];
	$isine = $row[3];
	$tgl = formatgl($row[5]);
	$idne = anti_injection($row[0]);
   $foto = $row[4];
	
	?>  
                    
                 	<a class="media media-single" href="#">
                    <?php 
$dirfoto = "../images/foto_berita/$foto";
if(!empty($foto) && (file_exists($dirfoto))){?>
     <img src='../images/foto_berita/<?php echo $foto; ?>' style="width:150px; height:150px;">
     <?php }else { echo "---";} ?>
					  <div class="media-body">
						<h6><?php echo $judul; ?><br /><font style="font-size:14px; line-height:130%;"<?php echo $isine; ?></font></h6>
						<small class="text-fader"><?php echo $tgl; ?></small>
					  </div>
					</a>
                    
                                            
        
	<?
		}
	?>
                
                
                
                    
                    
                    
                    
				  </div>
				</div>
             
            </div>
          </div>



</div>
</section>