<?php
require('db.php');
include "x.php";
?>
<?php
  if (isset($_GET['id'])) {

    $receive_id = $_GET['id'];

    $news_sql = "SELECT * FROM blog AS b INNER JOIN users AS u ON b.bby = u.uid  WHERE b.bid = '$receive_id'";
    $news_run = mysqli_query($con, $news_sql);
    $news_rows = mysqli_fetch_assoc($news_run);

    $oldCount = $news_rows['bcount'];
    $newCount = $oldCount + 1;

    // update news count
    $up_count_sql = "UPDATE blog SET bcount = '$newCount' WHERE bid = '$receive_id'";
    mysqli_query($con, $up_count_sql);
 $bPath = substr($news_rows['bimage'], 3);
              $bPath = "../../login/".$bPath;

				  
?>
	
<?php
                            
    $see_run = mysqli_query($con, "SELECT * FROM users WHERE uid = '$x'");
    $see_row = mysqli_fetch_assoc($see_run);
?>


<!doctype html>
<html lang="en">
  <head>
    
    	<meta charset="utf-8">
	  	<meta http-equiv="X-UA-Compatible" content="IE=edge">
	 	<meta name="viewport" content="width=device-width, initial-scale=1">
	  	<meta name="keywords" content="bengali news , latest news, news ,<?php echo $news_rows['btitle']; ?> ,<?php echo $news_rows['btag']; ?>"/>
	 	<meta property="og:url"                content="<?php echo $see_row["uweburl"]; ?>/single_news?id=<?php echo $news_rows['bid']; ?><?php echo $news_rows['btag']; ?>/" /> 
		<meta property="og:type"               content="article" />
		<meta property="og:title"              content="<?php echo $news_rows['btitle']; ?>" />
		<meta property="og:description"        content="<?php echo $news_rows['btitle']; ?>"/>
		<meta property="og:image"              content="<?php echo  $bPath; ?>" />

		<meta name="twitter:card" content="summary_large_image" />
		<meta name="twitter:url" content="<?php echo $see_row["uweburl"]; ?>/single_news?id=<?php echo $news_rows['bid']; ?><?php echo $news_rows['btag']; ?>/" />
		<meta name="twitter:title" content="<?php echo $news_rows['btitle']; ?>" />
		<meta name="twitter:description" content="<?php echo $news_rows['btitle']; ?>" />
		<meta name="twitter:image:src" content="<?php echo  $bPath; ?>" />
		<meta name="twitter:site" content="<?php echo $see_row["uname"]; ?>" />

     <?php include "include/css.php"; ?>
<style> #logo_wrapper img {
  max-width: 100%;
  height: auto;
 
 
}
 #Display_none img {
 display: none;
}

.fright{
 float: right;
 heig ht:90px;
}
.fleft{
 float: left;
 hei ght:90px;

}

  @media (max-width: 768px) { 
  .xxxx {
      
  width: 100%;
	   
  }
  

</style>
  </head>
  <body>
<?php include "include/header.php"; ?>

   <?php
                            
        $cat_run = mysqli_query($con, "SELECT * FROM category WHERE cid = '$news_rows[bcat]'");
        $cat_row = mysqli_fetch_assoc($cat_run);
          
	?>
	
	<?php
	  if ( $_GET['id'] ) {

	    $receive_id = $_GET['id'];
		$news_sql = "SELECT * FROM blog AS b INNER JOIN users AS u ON b.bby = u.uid INNER JOIN category AS c ON b.bcat = c.cid WHERE b.bid = '$receive_id'";
	    $news_run = mysqli_query($con, $news_sql);
	    $newsx_rows = mysqli_fetch_assoc($news_run);
	    $oldCount = $newsx_rows['bcount'];
	    $newCount = $oldCount + 1;
	    $sm=$newsx_rows['bcat'];
	    // update news count
	    $up_count_sql = "UPDATE blog SET bcount = '$newCount' WHERE bid = '$receive_id'";
	    mysqli_query($con, $up_count_sql);
		$sliderPath = substr($newsx_rows['bimage'], 3);
        $sliderPath = "login/".$sliderPath;
    ?>	
	
<section class="w3l-blog-breadcrum">
  <div class="breadcrum-bg py-sm-5 py-4">
    <div class="container py-lg-3">
      <h2><?php echo $newsx_rows['btitle']; ?></h2>
      <p><a href="index.php">Home</a> &nbsp; / <?php echo $newsx_rows['cname']; ?> &nbsp;/ <?php echo $newsx_rows['btitle']; ?>
    </div>
  </div>
</section>

<section class="w3l-blog-single">
	<div class="single blog py-5">
	  <div class="container py-md-3">
	
		<div class="d-grid grid-colunm-2">
		    
		  <!-- left side blog post content -->
		  <div class="single-left1">



			<div class="single-left12">
				<div class="blg-img">
			
			  <div class="bl-top">
				
			
			 </div>
			</div>
			 
			  <div class="btom-cont1 pt-4">
				<h5 class="card-title"><a href="#blog-single.html">
				    <?php echo $newsx_rows['btitle']; ?>
				    </a></h5>
				<ul class="admin-post">
				  <li>
					
				  </li>
				</ul>
				<p id="logo_wrapper"  class="mb-3"><?php echo $newsx_rows['blog']; ?></p>
			</div>
		</div>

			<br><br>	

							 




			
		  </div>
		  <!-- left side blog post content -->

		  <!-- right side bar -->
		  <div class="right-side-bar">
			
			
			<aside class="posts p-4 border">
			  <h3 class="aside-title"> </h3>
			  <div class="posts-grids">

			<?php                    
              $news_sql = "SELECT * FROM blog where   bcat='$sm' ORDER BY bid DESC LIMIT 10";
              $news_run = mysqli_query($con, $news_sql);
              while ( $news_rows = mysqli_fetch_assoc($news_run) ) {
                $newsPath = substr($news_rows['bimage'], 3);
				$newsPath = "login/".$newsPath;
                $trimmedTitle = mb_strimwidth($news_rows['btitle'], 0, 40, "...");
            ?>
				<div class="posts-grid-inner">
				  <div class="posts-grid-left pr-0">
					<a href='blog-single.php?id=<?php echo "$news_rows[bid]/$news_rows[btag]/";?>'>
					  <img src="<?php echo $newsPath; ?>" alt=" " class="img-responsive ">
					</a>
				  </div>
				  <div class="posts-grid-right">
					<h4>
					  <a href='blog-single.php?id=<?php echo "$news_rows[bid]/$news_rows[btag]/";?>' class="text-bl"><?php echo $trimmedTitle; ?></a>
					</h4>
					
				  </div>
				</div>
				<br>
			<?php 

			}

			?>


			  </div>
			</aside>
			
		

		  </div>
		  <!-- //right side bar -->
		</div>
	  </div>
	</div>
  </section>

<?php 
	}
	
 ?>  
<?php include "include/footer.php"; ?>
<?php include "include/js.php"; ?>

</body>

</html>
<!-- // grids block 5 -->


<?php 

}

 ?>