<?php
include("header.php");

	$HOST_NAME = "localhost";
		$DB_NAME = "itmecom";
		$CHAR_SET = "charset=utf8";
		$USERNAME = "admin_itmecom";
		$PASSWORD = "eB254w%4g";

$connect = null;

try {
    $connect = new PDO('mysql:host='.$HOST_NAME.';dbname='.$DB_NAME.';'.$CHAR_SET,$USERNAME,$PASSWORD);
    //session_start();
} catch (PDOException $e) {
    echo 'Connection failed: ' . $e->getMessage();
}


$query = "select * from content";
$statement = $connect->prepare($query);
$statement->execute();
$result_content = $statement->fetchAll();

?>
          <!-- Content wrapper -->
          <div class="content-wrapper" id="main-Content">
          	<div class="container-xxl flex-grow-1 container-p-y">
          		  <?php
		            foreach ($result_content as $key => $value) {
		                if($value['link'] != ""){
		                    $link = $value['link'];
		                }else{
		                    $link = "#";
		                }
		                ?>
		                    <div class="card card-custom gutter-b">
		                        <!--begin::Body-->
		                        <div class="card-body">
		                            <!--begin::Top-->
		                           
		                            <!--end::Top-->
		                            <!--begin::Bottom-->
		                            <div class="pt-4" >
		                                <!--begin::Image-->
		                                <div class="d-flex align-items-center  bgi-no-repeat bgi-size-cover rounded " style="display: flex;align-items: center;justify-content: center;">
		                               
		                                <a href="<?=$link?>" target="_blank"><img style="max-width: 100%" src="data:image/jpeg;base64,<?=base64_encode($value['image'] )?>"/></a>
		                                </div>
		                                <!--end::Image-->
		                                <!--begin::Text-->
		                                <center><p class="text-dark-75 font-size-lg font-weight-normal pt-5 mb-2"><?=$value['message']?></p></center>
		                                <!--end::Text-->
		                                <!--begin::Action-->
		                                
		                                <!--end::Action-->
		                            </div>
		                            <!--end::Bottom-->
		                            <!--begin::Separator-->
		                            
		                            <!--edit::Editor-->
		                        </div>
		                        <!--end::Body-->
		                    </div>
		                <?php
		            }
		            ?>
          	</div>
          
            
          </div>
          <?php
          if(($count_carts) > 0){
				?>
					<div class="buy-now">
					  
					  <div id="div-cart-stick" style="" class="btn-buy-now">
					  	
					  </div>
					  
					</div>
				<?php
		  }

include("footer.php");
?>