 <?php include ("kfunctions.php");
//include ("seredirect.php");
?>
<html>
<head>
<?php kheader(); ?>
<link href="css/bootstrap-datetimepicker.min.css" rel="stylesheet" media="screen">
<script src='js/jquery.js'></script>

</head> 
<body>

    <div id="wrapper">

        <!-- Navigation -->
        <nav class="navbar navbar-inverse navbar-fixed-top" role="navigation">
            <!-- Brand and toggle get grouped for better mobile display -->
            <?php ktopbar(); ?>
            <!-- Sidebar Menu Items - These collapse to the responsive navigation menu on small screens -->
            <?php kleftbar(); ?>
            <!-- /.navbar-collapse -->
        </nav>

        <div id="page-wrapper">

            <div class="container-fluid">
            
                 <div class="col-lg-12">
                        <h2 class="page-header">File Portal</h2>
                      </div>

<div class="col-lg-12">
<div class="panel panel-default">
<div class="panel-body">

<?php
$result_media = $dbh->query("select * from uploaded order by autoid desc limit 0,10");
$row_media = $result_media->fetchObject();
$count_media = $result_media->rowCount();

if($count_media>0){ do{
echo "
<div class='col-lg-4'>
<div class='panel panel-green'>
<div class='panel-body'>";

if($row_media->mediatype=="image"){echo "<img src='uploadspic/".$row_media->img."' style='height:40%;width:100%;'>";}
elseif($row_media->mediatype=="file"){echo "<img src='img/doc_img.png' style='height:40%;width:100%;'>";}
elseif($row_media->mediatype=="video"){echo "<img src='img/videologo.jpg' style='height:40%;width:100%;'>";}

echo "
<div class='list-group'>";
if(!empty($row_media->imgname)){ echo "<a class='list-group-item'>".$row_media->imgname."</a>";}
if(!empty($row_media->comment)){ echo "<a class='list-group-item'>".$row_media->comment."</a>";}

echo "
<a class='list-group-item'>
<form method='post' action='download.php'>
<input type='hidden' name='filename' value='".$row_media->img."'>
<input type='hidden' name='filetype' value='".$row_media->mediatype."'>
<input type='submit' class='btn btn-sm btn-primary' value='Download'></form></a>
</div>
</div></div>
</div>";
}while($row_media = $result_media->fetchObject());}
?>


                    </div>
                </div>
                <!-- /.row -->
                
    <!-- jQuery -->
    <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/1.11.1/jquery.js"></script>
       
</body>

</html>