<?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();} 
$current_url = urlencode($url="http://".$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI']);	
?>
     <!-- Breadcrumb Start -->
              <div class="breadcrumb-wrapper row">
                <div class="col-12" style="margin-bottom:25px;">
                  <h4 class="page-title" style="margin-left:5px;">Produk</h4>
                </div>
              </div>
              <!-- Breadcrumb End -->
<style>
ol.carousel-indicators {
   position: absolute;
   bottom: -25px;
   margin: 0;
   left: 0;
   right: 0;
   width: auto;
}

ol.carousel-indicators li,
ol.carousel-indicators li.active {
   width: 1rem;
   height: 1rem;
   margin: 0;
   border-radius: 50%;
   border: 0;
   background:;
}

ol.carousel-indicators li {
   background: rgba(153,153,153,0.5);
   margin-left: .5rem;
   margin-right: .5rem;
}

ol.carousel-indicators li.active {
   background: red;
}

/* Global settings */
 
.product-image {
  float: left;
  width: 20%;
}
 
.product-details {
  float: left;
  width: 37%;
}
 
.product-price {
  float: left;
  width: 12%;
}
 
.product-quantity {
  float: left;
  width: 10%;
}
 
.product-removal {
  float: left;
  width: 20%;
}
 
.product-line-price {
  float: left;
  width: 1%;
  text-align: right;
}
 
/* This is used as the traditional .clearfix class */
.group:before, .shopping-cart:before, .column-labels:before, .product:before, .totals-item:before,
.group:after,
.shopping-cart:after,
.column-labels:after,
.product:after,
.totals-item:after {
  content: '';
  display: table;
}
 
.group:after, .shopping-cart:after, .column-labels:after, .product:after, .totals-item:after {
  clear: both;
}
 
.group, .shopping-cart, .column-labels, .product, .totals-item {
  zoom: 1;
}
 
/* Apply clearfix in a few places */
/* Apply dollar signs */
.product .product-price:before, .product .product-line-price:before, .totals-value:before {
  content: '';
}
 
/* Body/Header stuff */

 
label {
  color: #aaa;
}
 
.shopping-cart {
  margin-top: -45px;
}
 
/* Column headers */
.column-labels label {
  padding-bottom: 15px;
  margin-bottom: 15px;
  border-bottom: 1px solid #eee;
}
.column-labels .product-image, .column-labels .product-details, .column-labels .product-removal {
  text-indent: -9999px;
}
 
/* Product entries */
.product {
  margin-bottom: 20px;
  padding-bottom: 10px;
  border-bottom: 1px solid #eee;
}
.product .product-image {
  text-align: center;
}
.product .product-image img {
  width: 100px;
}
.product .product-details .product-title {
  margin-right: 20px;
  font-family: "HelveticaNeue-Medium", "Helvetica Neue Medium";
}
.product .product-details .product-description {
  margin: 5px 20px 5px 0;
  line-height: 1.4em;
}
.product .product-quantity input {
  width: 40px;
}
.product .remove-product {
  border: 0;
  padding: 4px 8px;
  background-color: #c66;
  color: #fff;
  font-family: "HelveticaNeue-Medium", "Helvetica Neue Medium";
  font-size: 12px;
  border-radius: 3px;
}
.product .remove-product:hover {
  background-color: #a44;
}
 
/* Totals section */
.totals .totals-item {
  float: right;
  clear: both;
  width: 100%;
  margin-bottom: 10px;
}
.totals .totals-item label {
  float: left;
  clear: both;
  width: 79%;
  text-align: right;
}
.totals .totals-item .totals-value {
  float: right;
  width: 21%;
  text-align: right;
}
.totals .totals-item-total {
  font-family: "HelveticaNeue-Medium", "Helvetica Neue Medium";
}
 
.checkout {
  float: right;
  border: 0;
  margin-top: 20px;
  padding: 6px 25px;
  background-color: #6b6;
  color: #fff;
  font-size: 25px;
  border-radius: 3px;
}
 
.checkout:hover {
  background-color: #494;
}
 
/* Make adjustments for tablet */
@media screen and (max-width: 650px) {
  .shopping-cart {
    margin: 0;
    padding-top: 20px;
    border-top: 1px solid #eee;
  }
 
  .column-labels {
    display: none;
  }
 
  .product-image {
    float: right;
    width: auto;
  }
  .product-image img {
    margin: 0 0 10px 10px;
  }
 
  .product-details {
    float: none;
    margin-bottom: 10px;
    width: auto;
  }
 
  .product-price {
    clear: both;
    width: 70px;
  }
 
  .product-quantity {
    width: 100px;
  }
  .product-quantity input {
    margin-left: 20px;
  }
 
  .product-quantity:before {
    content: 'x';
  }
 
  .product-removal {
    width: auto;
	margin-top:10px;
  }
 
  .product-line-price {
    float: right;
    width: 70px;
  }
}
/* Make more adjustments for phone */
@media screen and (max-width: 350px) {
  .product-removal {
    float: right;
	margin-top:10px;
  }
 
  .product-line-price {
    float: right;
    clear: left;
    width: auto;
    margin-top: 10px;
  }
 
  .product .product-line-price:before {
    content: 'Item Total: $';
  }
 
  .totals .totals-item label {
    width: 60%;
  }
  .totals .totals-item .totals-value {
    width: 40%;
  }
}
.cart_top			{ float:left; margin:0px 0px 0px 10px; padding:1px; height:30px; background:#fff; border:1px solid #c3c2c8; border-radius:3px; }
.cart_top .cart_t	{ display:block; margin:0; padding:0px; width:auto; height:30px; border-radius:2px;
							  background:url(../img/frontend/btn_top_bg.png) repeat-x top center; font-size:14px; }
.cart_top .cart_t a			{ color:#3E3E3E; }
.cart_top .cart_t a:hover	{ color:#676767; }
.cart_top .cart_t span		{ float:left; margin:0; padding:0 12px; min-width:100px; display:block; height:30px; line-height:26px; text-align:center; 
									  border:0px solid #007D00; border-radius:0 2px 2px 0; }
.cart_top .cart_t span.icon	{ margin:0; padding:0; width:30px; min-width:inherit; border-right-color:#AEFFAE; border-radius:2px 0 0 2px; 
									  box-shadow:inset -1px 0px 0px #CECECE; background:url(../img/frontend/cart_top_icon.png) no-repeat 5px center; }
.shake{display:inline-block}
.shake:hover,.shake:focus{-moz-animation:shake .8s linear infinite;-webkit-animation:shake .8s linear infinite;-o-animation:shake .8s linear infinite;animation:shake .8s linear infinite;-moz-transform-origin:50% 50%;-webkit-transform-origin:50% 50%;-o-transform-origin:50% 50%;-ms-transform-origin:50% 50%;transform-origin:50% 50%}

	div.pagings {
	padding     : 2px;
	margin      : 2px;
	font-family : Tahoma;
	font-size   : 11px;
	line-height:220%;
}
div.pagings a {
	padding:4px 7px 4px 7px;
	margin:2px;
	border:1px solid #C2D0DC;
	color: #444444;
	border-radius:3px;	
	-moz-border-radius:3px;
	-webkit-border-radius:3px;
	text-decoration:none;
	background:#ecf1f5; background:-moz-linear-gradient(top, #f6f9fb 0%, #d9e1e9 100%); 
								  background:-webkit-linear-gradient(top, #f6f9fb 0%, #d9e1e9 100%); box-shadow:inset 0px 1px 0px #fff,inset 0px 0px 0px 1px #f3f7fb;
}
div.pagings a:hover {
	border: 1px solid #999;
	color: #000;
}
div.pagings span.current {
	 margin: 2px;
	padding:4px 7px 4px 7px;
		border: 1px solid #999;
	color: #fff;
		border-radius:3px;	
	-moz-border-radius:3px;
	-webkit-border-radius:3px;
	text-decoration:none;
	background:#ecf1f5; background:-moz-linear-gradient(top, #999999 0%, #7E7E7E 100%); 
								  background:-webkit-linear-gradient(top, #999999 0%, #7E7E7E 100%); box-shadow:inset 0px 1px 0px #fff,inset 0px 0px 0px 1px #f3f7fb;
}
div.pagings span.disabled {
	padding:4px 7px 4px 7px;
		margin:2px;
		border:1px solid #E2E2E2;
		color:#CCCCCC;
		border-radius:3px;	
	-moz-border-radius:3px;
	-webkit-border-radius:3px;
	text-decoration:none;
		background:#ecf1f5; background:-moz-linear-gradient(top, #ffffff 0%, #E2E2E2 100%); 
								  background:-webkit-linear-gradient(top, #ffffff 0%, #E2E2E2 100%); box-shadow:inset 0px 1px 0px #fff,inset 0px 0px 0px 1px #f3f7fb;
}
div.pagings span.prevnext {
  font-weight : bold;
}									  
div.pagings {
	padding     : 2px;
	margin      : 2px;
	font-family : Tahoma;
	font-size   : 11px;
	line-height:220%;
}
div.pagings a {
	padding:4px 7px 4px 7px;
	margin:2px;
	border:1px solid #C2D0DC;
	color: #444444;
	border-radius:3px;	
	-moz-border-radius:3px;
	-webkit-border-radius:3px;
	text-decoration:none;
	background:#ecf1f5; background:-moz-linear-gradient(top, #f6f9fb 0%, #d9e1e9 100%); 
								  background:-webkit-linear-gradient(top, #f6f9fb 0%, #d9e1e9 100%); box-shadow:inset 0px 1px 0px #fff,inset 0px 0px 0px 1px #f3f7fb;
}
div.pagings a:hover {
	border: 1px solid #999;
	color: #000;
}
div.pagings span.current {
	 margin: 2px;
	padding:4px 7px 4px 7px;
		border: 1px solid #999;
	color: #fff;
		border-radius:3px;	
	-moz-border-radius:3px;
	-webkit-border-radius:3px;
	text-decoration:none;
	background:#ecf1f5; background:-moz-linear-gradient(top, #999999 0%, #7E7E7E 100%); 
								  background:-webkit-linear-gradient(top, #999999 0%, #7E7E7E 100%); box-shadow:inset 0px 1px 0px #fff,inset 0px 0px 0px 1px #f3f7fb;
}
div.pagings span.disabled {
	padding:4px 7px 4px 7px;
		margin:2px;
		border:1px solid #E2E2E2;
		color:#CCCCCC;
		border-radius:3px;	
	-moz-border-radius:3px;
	-webkit-border-radius:3px;
	text-decoration:none;
		background:#ecf1f5; background:-moz-linear-gradient(top, #ffffff 0%, #E2E2E2 100%); 
								  background:-webkit-linear-gradient(top, #ffffff 0%, #E2E2E2 100%); box-shadow:inset 0px 1px 0px #fff,inset 0px 0px 0px 1px #f3f7fb;
}
div.pagings span.prevnext {
  font-weight : bold;
}
	</style>

 
<?
if (isset($_GET['page']) && $_GET['page'] == "detail") { 
if(isset($_GET["nid"])){$nide = anti_injection($_GET["nid"]);}
?>

<div class="row">
   <div class="col-md-12">
                  <div class="card">
                    <div class="card-header">
                      <h5 class="card-title">Detail Produk <?php echo $nide;?></h5>
                    </div>
                    <div class="card-body">    
                    
                    
       <?php
if(isset($_GET['error'])) {
echo "<div class='alert alert-danger alert-dismissable'><button type='button' class='close' data-dismiss='alert' aria-hidden='true'></button>Stock Barang Tidak Cukup</div>";
}
?>             
                      
 
 
<?php
$db->select("no, userid, nama, kota, testimoni, foto, published, tgl, judul, referal, hp, email, hits, published, telp, foto2, foto3, foto4, tag, desc1, kode, catid, ready, price, paygtw, bank, review, asteriks, zoomer, disc, ready", "iklan", "no='$nide' and status='1' and published='1'","");
	$row = $db->fetch_row();
	$adafoto = $row[5];
	$adafoto2 = $row[15];
	$adafoto3 = $row[16];
	$adafoto4 = $row[17];
	$tanggal = formatgl($row[7]);
	$jame = date('H:i', strtotime($row[7]));
	$dmyne = date('d/m/Y', strtotime($row[7]));
	$hits = $row[12];
	$judule = $row[8];
	$isine = $row[4];
	$namae = $row[2];
	$user = $row[1];
	$kotane = $row[3];
	$tage = $row[18];
	$desce = $row[19];
	$kodep = $row[20];
	$catide = $row[21];
	$ready = $row[22];
	$paygtw = $row[24];
	$bankd = $row[25];
	$review = $row[26];
	$asteriks = $row[27];
	$zoomer = $row[28];
	$disc = $row[29];
	$hargax = $row[23];
	$ready = $row[30];
	
	if($asteriks == 1){
	$emaile = hide_mail($row[11]);
	$phonee = hide_phone($row[14]);
	}else{
	$emaile = $row[11];
	$phonee = $row[14];
	}
	$hargav=$hargax;
	
	
	
	if($disc){
	$disce = ($disc/100)*$hargav;
	$harga = $hargav-$disce;
	$hargae = rupiah($harga);
	}else{
	$harga = $hargav;
	$hargae = rupiah($harga);
	}
	
	
	$price = rupiah($hargav);
	$webe = $row[9];
	$dirfoto = "../images/foto_iklan/$row[5]";
	$dirfoto2 = "../images/foto_iklan/$row[15]";
	$dirfoto3 = "../images/foto_iklan/$row[16]";
	$dirfoto4 = "../images/foto_iklan/$row[17]";
	if(!empty($row[3])){	
		$kota = "<br /><i class='fa fa-map-marker'></i>&nbsp;&nbsp;".$row[3]."<br />";	
	  }
	if(!empty($row[14])){	
		$telp = "<i class='fa fa-phone'></i>&nbsp;&nbsp;".$row[14]."<br />";	
	  } 
	  if(!empty($row[11])){	
		$email = "<i class='fa fa-envelope-o'></i>&nbsp;&nbsp;".$row[11]."<br />";	
	  } 
	 if (!empty($adafoto) && (file_exists($dirfoto))){
		$fotoku = "<a href='../images/foto_iklan/".$row[5]."' class='highslide' onclick='return hs.expand(this)'>
               <img src='../images/foto_iklan/".$row[5]."' class='d-block w-100' alt='First slide'/></a>";
		$fotokub = "<img src='images/foto_iklan/".$row[5]."' alt='".$row[2]."'/>";
		$fotokuc = "<img src='images/foto_iklan/".$row[5]."' alt='".$row[2]."' data-role='thumb' class='pic'/>";
		}
		else
		{
		$fotoku = "<a href='../images/image-not-available.jpg' class='highslide' onclick='return hs.expand(this)'><img src='../images/image-not-available.jpg'  class='d-block w-100' alt='First slide'></a>";
		$fotokub = "<img src='../images/image-not-available.jpg'  alt='".$row[2]."'>";
		$fotokuc = "<img src='images/image-not-available.jpg'  alt='".$row[2]."' data-role='thumb' class='pic'>";
		} 
		
		if (!empty($adafoto2) && (file_exists($dirfoto2))){
		$fotoku2 = "<a href='".$dirfoto2."' class='highslide' onclick='return hs.expand(this)'>
               <img src='".$dirfoto2."'  class='d-block w-100' alt='Second slide'/></a>";
			   $fotoku2b = "<img src='".$dirfoto2."' onerror='this.src='".$dirfoto2."''/>";
		}
		else
		{
		$fotoku2 = "<a href='../images/image-not-available.jpg' class='highslide' onclick='return hs.expand(this)'><img src='../images/image-not-available.jpg'  class='d-block w-100' alt='Second slide'></a>";
		$fotoku2b = "<img src='images/image-not-available.jpg' onerror='this.src='images/image-not-available.jpg''>";
		} 
		
		
		if (!empty($adafoto3) && (file_exists($dirfoto3))){
		$fotoku3 = "<a href='".$dirfoto3."' class='highslide' onclick='return hs.expand(this)'>
               <img src='".$dirfoto3."'   class='d-block w-100' alt='Third slide'/></a>";
			   $fotoku3b = "<img src='".$dirfoto3."'  onerror='this.src='".$dirfoto3."''/>";
		}
		else
		{
		$fotoku3 = "<a href='../images/image-not-available.jpg' class='highslide' onclick='return hs.expand(this)'><img src='../images/image-not-available.jpg'  class='d-block w-100' alt='Third slide'></a>";
		$fotoku3b = "<img src='images/image-not-available.jpg' class='d-block w-100' alt='Third slide'>";
		} 
		
		if (!empty($adafoto4) && (file_exists($dirfoto4))){
		$fotoku4 = "<a href='".$dirfoto4."' class='highslide' onclick='return hs.expand(this)'>
               <img src='".$dirfoto4."'  class='d-block w-100' alt='Fourth slide'/></a>";
			   $fotoku4b = "<img src='".$dirfoto4."'  onerror='this.src='".$dirfoto4."''/>";
		}
		else
		{
		$fotoku4 = "<a href='../images/image-not-available.jpg' class='highslide' onclick='return hs.expand(this)'><img src='../images/image-not-available.jpg' class='d-block w-100' alt='Fourth slide'></a>";
		$fotoku4b = "<img src='images/image-not-available.jpg' onerror='this.src='images/image-not-available.jpg''>";
		} 
		
	$cekmanage = "SELECT * FROM member WHERE username='".$row[1]."'"; 
$manageuser = mysql_query($cekmanage) or die(mysql_error());
$rowmanager = mysql_fetch_array($manageuser);
$managerft = $rowmanager['foto'];	
$dirfotoft = "./member/images/$managerft";	
		
		if (!empty($managerft) && (file_exists($dirfotoft))){
		$fotokuft = "<a href='".$dirfotoft."' class='highslide' onclick='return hs.expand(this)'><img src='".$dirfotoft."'/></a>";
		$fotokuft2 = "<img src='".$dirfotoft."' style='width:100px; height:100px;'class='imgku6z'/>";	   
		}
		else
		{
		$fotokuft = "<a href='images/no_image.png' class='highslide' onclick='return hs.expand(this)'><img src='images/no_image.png'/></a>";
		} 
		$fotokuft2 = "<img src='images/no_image.png' style='width:100px; height:100px;' title='Tidak ada gambar' class='imgku6z'>";
		
		if ($ready == 1){
		$readyne = "Ready Stock";
		$beline = "";	   
		}
		else
		{
		
		$readyne = "Empty";
		$beline = "";	   
		} 
		if ($ready > 0){
		$readyne = "<font style='font-weight:bold; color:#096'>".$ready." Barang</font>";
		$beline = "";	   
		}
		else
		{
		
		$readyne = "<font style='font-weight:bold; color:#F00'>Kosong</font>";
		$beline = " disabled='disabled'";	   
		} 
		
		
        $mailss="Enter Your Mail Here";     
setcookie("Amounts",$row[23], time()+3600);
setcookie("Email",$mailss, time()+3600);
setcookie("Nama",$row[2], time()+3600);

		
			
		?>
 
 
 
                    
<div class="container-fluid">
    <div class="content-wrapper">	
		<div class="item-container">	
			<div class="container">	
				<div class="col-md-6">
					
<div class="card-body">
<div class="row m-t-35 m-b-30">
<div class="col-md-8 offset-md-0">
<div id="carouselExampleIndicators" class="carousel slide" data-ride="carousel" data-interval="2000">
<ol class="carousel-indicators">
<li data-target="#carouselExampleIndicators" data-slide-to="0" class="active"></li>
<li data-target="#carouselExampleIndicators" data-slide-to="1" class=""></li>
<li data-target="#carouselExampleIndicators" data-slide-to="2" class=""></li>
<li data-target="#carouselExampleIndicators" data-slide-to="3" class=""></li>
</ol>
<div class="carousel-inner">
<div class="carousel-item active" style="width:100%;">
<?php echo $fotoku; ?>
</div>
<div class="carousel-item" style="width:100%;">
<?php echo $fotoku2; ?>
</div>
<div class="carousel-item" style="width:100%;">
<?php echo $fotoku3; ?>
</div>
<div class="carousel-item" style="width:100%;">
<?php echo $fotoku4; ?>
</div>
</div>
<a class="carousel-control-prev" href="#carouselExampleIndicators" role="button" data-slide="prev">
<span class="fa fa-arrow-circle-o-left" aria-hidden="true"></span>
</a>
<a class="carousel-control-next" href="#carouselExampleIndicators" role="button" data-slide="next">
<span class="fa fa-arrow-circle-o-right" aria-hidden="true"></span>
</a>
</div>
</div>
</div>
</div>
				</div>
					
				<div class="col-md-7">
					<div class="product-title" style="font-size:24px; margin-bottom:15px;"><?php echo $judule;?></div>
					<div class="product-desc">Stock <?php echo $readyne;?></div>
					<div class="product-rating"><?php if($disc){ ?>
                           <font style='font-size:9pt;line-height:150%;font-family:Arial; color:#666666;'><strike><?php echo $price; ?></strike></font>&nbsp;&nbsp;<font style='font-size:9pt;line-height:150%;font-family:Arial;color:#FFFFFF; background-color:#FF3C3C; padding:2px;'>Disc <?php echo $disc; ?>%</font><br /><font style="font-size:20px;"><strong><?php echo $hargae; ?></strong></font>
                            <?php } else { ?>
                            <font style="font-size:20px;"><strong><?php echo $hargae; ?></strong></font>
                            <?php } ?></div>
					<hr>
					<div class="btn-group cart">
						<form action="cart_update.php" method="post" class="form-inline">
<input type="hidden" name="kode" value="<?php echo $kodep; ?>" />
	<input type="hidden" name="type" value="add" />
	<input type="hidden" name="return_url" value="<?php echo $current_url; ?>" />
    <input type="number" name="qty" value="1"  class="form-control" style="width:90px; text-align:center;height:45px;" min="1" <?php echo $beline; ?> max="<?php echo $ready; ?>" required="required"/>  
                  
                          <button class="btn btn-primary" id="add" <?php echo $beline; ?> onclick="$(this).closest('form').submit()" type="button" style="height:45px; margin-left:10px;">Buy</button>
                  
                    </form> 	
					</div>
					<div class="btn-group wishlist">
					
					</div>
				</div>
			</div> 
		</div>
		<div class="container-fluid">		
			
            
            
            
            <div class="col-md-12 tab-info" style="margin-top:20px;">
					<ul  role="tablist" class="nav nav-tabs">
						
					<li class="nav-item">
<a href="#default-tab-1" class="nav-link active" role="tab" data-toggle="tab">Deskripsi</a>
</li>
<li class="nav-item">
<a href="#default-tab-2" class="nav-link" role="tab" data-toggle="tab">Pembayaran</a>
</li>
<?php if($reviewproduk == 1 && $review == 1){ ?>
<li class="nav-item">
<a href="#default-tab-3" class="nav-link" role="tab" data-toggle="tab">Review</a>
</li>
<?php } ?>
<?php if($reviewproduk == 1 && $review == 1){ ?>
<li class="nav-item">
<a href="#default-tab-4" class="nav-link" role="tab" data-toggle="tab">Add Review</a>
</li>
<?php } ?>
						
					</ul>
				<div class="tab-content">
<div role="tabpanel" class="tab-pane active" id="default-tab-1">
<div class="p-20">
<p><?php echo $isine;?></p>
</div>
</div>
<div role="tabpanel" class="tab-pane fade" id="default-tab-2">
<div class="p-20">

<div style="max-width:450px; width:100%;"><?php $db->bannerrek2a(); ?>

  <table class='table' style='width:100%;'>
<?php if($ovopay == 1){ ?>
<tr>
<td><img src='../themes/ovo.png' width='100' title='Pay OVO'/></td>
<td>OVO : <?php echo $ovoaddress;?></td>
</tr>
<?php } ?>
<?php if($danapay == 1){ ?>
<tr>
<td><img src='../themes/dana.png' width='100' title='Pay DANA'/></td>
<td>DANA : <?php echo $danaaddress;?></td>
</tr>
<?php } ?>
<?php if($gopay == 1){ ?>
<tr>
<td><img src='../themes/gopay.png' width='100' title='Pay GOPAY'/></td>
<td>GOPAY : <?php echo $gopayaddress;?></td>
</tr>
<?php } ?>
</table>

</div>


</div>
</div>
<?php if($reviewproduk == 1 && $review == 1){ ?>
<div role="tabpanel" class="tab-pane fade" id="default-tab-3">
<div class="p-20">
<p>Review</p>
</div>
</div>
<?php } ?>
<?php if($reviewproduk == 1 && $review == 1){ ?>
<div role="tabpanel" class="tab-pane fade" id="default-tab-4">
<div class="p-20">
<p>add review</p>
</div>
</div>
<?php } ?>
</div>
				<hr>
			</div>
		</div>
	</div>
</div>



			</div>
		</div>
	</div>
</div>




<?php } else { ?>
<div class="row">
   <div class="col-md-12">
                  <div class="card">
                    <div class="card-header">
                      <h5 class="card-title">Produk     
                      </h5>
                      <div class="cart_top shake" style="float:right;">
                    <div class="cart_t">
                    <?php
	if(isset($_SESSION["cart_products"])) //check session var
    {
		$total = 0; //set initial total value
		$b = 0; //var for zebra stripe table 
		foreach ($_SESSION["cart_products"] as $cart_itm)
		
        {
			$product_qty = $cart_itm["qty"];
			$product_code = $cart_itm["kode"];
			$subtotal = ($product_price * $product_qty); //calculate Price x Qty
		}}
					?>
                        <a href="index.php?go=checkout" title="My Cart" ><span class="icon"></span><span><b>CHECKOUT</b></span></a>
                    </div>
                </div>       
                    </div>
                    <div class="card-body">    
                    
                    
                    
                    
    <?php
if(isset($_GET['error'])) {
echo "<div class='alert alert-danger alert-dismissable'><button type='button' class='close' data-dismiss='alert' aria-hidden='true'></button>Stock Barang Tidak Cukup</div>";
}
?>             
                              
                    
                    
                    
    <div style="margin-bottom:40px;">             
                         
  <?php
function anti_injections($string) {
$string = trim($string); // Keep your usernames clean
$string = stripslashes($string);
$string = strip_tags($string); // Kill all tags like html tags, etc..
$string = mysql_real_escape_string($string);
$string = preg_replace("/(show tables|drop table|alter table|#|\*|--|'|;|\\\\)/",'',$string);
return $string;
}	

if(isset($_GET["search-tag"])){$tag=anti_injections($_GET["search-tag"]);$search="and tag like '%$tag%' or userid like '%$tag%'";$clear="<a href='./index.php?go=produk'><button type='button' class='btn btn-danger'style='margin-left:10px;'>Clear</button></a>";$scrr=$tag;}else {$search="";$clear="";$scrr="Pencarian...";}?>
 <form name="search" method="GET" action="index.php" class="form-inline">
 <input id="go" name="go"  type="hidden" value="produk" />
 <input id="search-tag" name="search-tag"  type="text" maxlength="255" value="<?php echo $scrr; ?>" onfocus="if(this.value == 'Pencarian...') { this.value = ''; }" onblur="if(this.value=='') { this.value='Pencarian...'; }" class="form-control" style="width:99%; max-width:200px; margin-right:10px; height:35px;"/>
 <button type='submit' class='btn btn-primary'>Cari</button>&nbsp;<?php echo $clear; ?>
 </form>                   
                    
                    
  <form id="form2"  name="form2" method="post" action="?go=produk"  class="form-inline" style="margin-top:15px;">
	 <?php
	 if(isset($_REQUEST['catid'])){$catid = $_REQUEST['catid'];} 
	 if(empty($catid)){
	 $vlue = "Semua";
	 $catid = "Semua";
	 }
	 ?>
	   <select name="catid" class="form-control" style="width:99%; max-width:200px;margin-right:10px;">
<option value="<?php echo $vlue; ?>" selected="selected"><?php echo $catid; ?></option>
<option value="Aneka" disabled="disabled">
Aneka</option>
<option value="Biro Jasa">&nbsp;&nbsp;
Biro Jasa</option>
<option value="Busana-Fashion">&nbsp;&nbsp;
Busana-Fashion</option>
<option value="Hewan">&nbsp;&nbsp;
Hewan</option>
<option value="Khusus Dewasa">&nbsp;&nbsp;
Khusus Dewasa</option>
<option value="Lain-lain">&nbsp;&nbsp;
Lain-lain</option>
<option value="Makanan - Restoran">&nbsp;&nbsp;
Makanan - Restoran</option>
<option value="Pendidikan - Kursus">&nbsp;&nbsp;
Pendidikan - Kursus</option>
<option value="Pengobatan-Kesehatan">&nbsp;&nbsp;
Pengobatan-Kesehatan</option>

<option value="Bisnis &amp; Pekerjaaan" disabled="disabled">
Bisnis &amp; Pekerjaaan</option>
<option value="Agen - Penyalur">&nbsp;&nbsp;
Agen - Penyalur</option>
<option value="Agrobisnis">&nbsp;&nbsp;
Agrobisnis</option>
<option value="Kerajinan - Industri Kecil">&nbsp;&nbsp;
Kerajinan - Industri Kecil</option>
<option value="Lowongan Kerja">&nbsp;&nbsp;
Lowongan Kerja</option>
<option value="Network Marketing">&nbsp;&nbsp;
Network Marketing</option>
<option value="Peluang Usaha">&nbsp;&nbsp;
Peluang Usaha</option>
<option value="Perbankan-Kredit">&nbsp;&nbsp;
Perbankan-Kredit </option>

<option value="Bisnis Online">
Bisnis Online</option>

<option value="Busana Fashoin">
Busana Fashoin</option>

<option value="Informasi" disabled="disabled">
Informasi</option>
<option value="Berita Duka">&nbsp;&nbsp;
Berita Duka</option>
<option value="Kehilangan">&nbsp;&nbsp;
Kehilangan</option>
<option value="Kontak Jodoh">&nbsp;&nbsp;
Kontak Jodoh</option>
<option value="Pernikahan-Pesta">&nbsp;&nbsp;
Pernikahan-Pesta</option>
<option value="Ramalan">&nbsp;&nbsp;
Ramalan</option>

<option value="Internet &amp; Komputer" disabled="disabled">
Internet &amp; Komputer</option>
<option value="Aksesoris">&nbsp;&nbsp;
Aksesoris</option>
<option value="Bisnis &amp; jasa online">&nbsp;&nbsp;
Bisnis &amp; jasa online</option>
<option value="Hosting - Domain">&nbsp;&nbsp;
Hosting - Domain</option>
<option value="Software">&nbsp;&nbsp;
Software</option>
<option value="Warnet - Rental">&nbsp;&nbsp;
Warnet - Rental</option>
<option value="Web Desain">&nbsp;&nbsp;
Web Desain</option>

<option value="Kendaraan" disabled="disabled">
Kendaraan</option>
<option value="Mobil">&nbsp;&nbsp;
Mobil </option>
<option value="Motor">&nbsp;&nbsp;
Motor</option>
<option value="Rental">&nbsp;&nbsp;
Rental</option>
<option value="Spare Parts">&nbsp;&nbsp;
Spare Parts</option>

<option value="Kesehatan-Pengobatan">
Kesehatan-Pengobatan</option>

<option value="Peralatan &amp; Elektronika" disabled="disabled">
Peralatan &amp; Elektronika</option>
<option value="Aksesoris">&nbsp;&nbsp;
Aksesoris</option>
<option value="Alat Kantor">&nbsp;&nbsp;
Alat Kantor</option>
<option value="Alat Rumah Tangga">&nbsp;&nbsp;
Alat Rumah Tangga</option>
<option value="Furniture">&nbsp;&nbsp;
Furniture</option>
<option value="Kamera">&nbsp;&nbsp;
Kamera</option>
<option value="Media Player">&nbsp;&nbsp;
Media Player</option>
<option value="Ponsel &amp; Pulsa">&nbsp;&nbsp;
Ponsel &amp; Pulsa</option>

<option value="Properti" disabled="disabled">
Properti</option>
<option value="Apartemen-Perumahan-Villa">&nbsp;&nbsp;
Apartemen-Perumahan-Villa</option>
<option value="Arsitektur">&nbsp;&nbsp;
Arsitektur</option>
<option value="Bahan Bangunan">&nbsp;&nbsp;
Bahan Bangunan</option>
<option value="Indekost">&nbsp;&nbsp;
Indekost</option>
<option value="Ruko">&nbsp;&nbsp;
Ruko</option>
<option value="Rumah &amp; Tanah">&nbsp;&nbsp;
Rumah &amp; Tanah</option>

<option value="Wisata" disabled="disabled">
Wisata</option>
<option value="Hotel-Penginapan-Cottage">&nbsp;&nbsp;
Hotel-Penginapan-Cottage</option>
<option value="Tempat Rekreasi">&nbsp;&nbsp;
Tempat Rekreasi</option>
<option value="Tour &amp; Travel">&nbsp;&nbsp;
Tour &amp; Travel</option>
<option value="Tourist Guide">&nbsp;&nbsp;
Tourist Guide</option>
<option value="Semua">
Semua</option>
</select>	
&nbsp;<input type="submit" name="Submit" value="Lihat"  class='btn btn-primary'/>
</form>	                                                 
                    
                    
                    
                    
                        
                
                                  
                   </div>     
                    
                    
                    
                    
                      
<div class="shopping-cart">
 
 
 
  <div class="column-labels">
    <label class="product-image">Image</label>
    <label class="product-details">Product</label>
    <label class="product-price">Price</label>
    <label class="product-quantity">Quantity</label>
    <label class="product-removal">Remove</label>
    <label class="product-line-price">&nbsp;</label>
  </div>
 
  
  
   <?


$batas   = 25;
if(isset($_GET['halaman'])) { $halaman = anti_injection($_GET['halaman']); } 
if(empty($halaman)){
	$posisi  = 0;
	$halaman = 1;
}
else{
	$posisi = ($halaman-1) * $batas;
}
if(isset($_GET['sub'])) {
	$sbbb="and tag='".$_GET['sub']."'";
}else{
	$sbbb="";
}
if(isset($_POST['Submit'])) {
$catid = $_POST['catid'];
if($catid == "Semua"){
$db->select("no, userid, nama, kota, testimoni, foto, published, tgl, judul, referal, hp, email, hits, telp, catid, price, desc1, disc, kode, foto2, foto3, foto4, ready", "iklan", "published='1' and status='1' $search $sbbb", "tgl desc LIMIT $posisi,$batas");
}else{
$db->select("no, userid, nama, kota, testimoni, foto, published, tgl, judul, referal, hp, email, hits, telp, catid, price, desc1, disc, kode, foto2, foto3, foto4, ready", "iklan", "catid ='$catid' and published='1' and status='1' $search $sbbb", "tgl desc LIMIT $posisi,$batas");
}
} else {
$db->select("no, userid, nama, kota, testimoni, foto, published, tgl, judul, referal, hp, email, hits, telp, catid, price, desc1, disc, kode, foto2, foto3, foto4, ready", "iklan", "published='1' and status='1' $search $sbbb", "tgl desc LIMIT $posisi,$batas");
}
if($db->num_rows() > 0) {
	//echo $db->result(0, "maintext");
	while($row = $db->fetch_row()) {
	$user = $row[1];
	$tanggals = formatgl($row[7]);
	$nides = anti_injection($row[0]);
	$adafoto = $row[5];
	$dirfoto = "../images/foto_iklan/$row[5]";
	if (!empty($adafoto) && (file_exists($dirfoto))){
		$gambar = "<a href='../images/foto_iklan/$adafoto' class='highslide' onclick='return hs.expand(this)'><img src='../images/foto_iklan/$adafoto' class='attachment-thumbnail' alt=''/></a>";
		}
	else
		{
		$gambar = "";
		} 
	
	$adafoto2 = $row[19];
	$dirfoto2 = "../images/foto_iklan/$row[19]";	
	if (!empty($adafoto2) && (file_exists($dirfoto2))){
		$gambar2 = "<a href='../images/foto_iklan/$adafoto2' class='highslide' onclick='return hs.expand(this)'><img src='../images/foto_iklan/$adafoto2' class='attachment-thumbnail' alt=''/></a>";
		}
	else
		{
		$gambar2 = "";
		} 
	
	$adafoto3 = $row[20];
	$dirfoto3 = "../images/foto_iklan/$row[20]";	
	if (!empty($adafoto3) && (file_exists($dirfoto3))){
		$gambar3 = "<a href='../images/foto_iklan/$adafoto3' class='highslide' onclick='return hs.expand(this)'><img src='../images/foto_iklan/$adafoto3' class='attachment-thumbnail' alt=''/></a>";
		}
	else
		{
		$gambar3 = "";
		} 
	$adafoto4 = $row[21];
	$dirfoto4 = "../images/foto_iklan/$row[21]";	
	if (!empty($adafoto4) && (file_exists($dirfoto4))){
		$gambar4 = "<a href='../images/foto_iklan/$adafoto4' class='highslide' onclick='return hs.expand(this)'><img src='../images/foto_iklan/$adafoto4' class='attachment-thumbnail' alt=''/></a>";
		}
	else
		{
		$gambar4 = "";
		} 
	
		
	$tanggal = formatgl($row[7]);
	$jame = date('H:i', strtotime($row[7]));
	$hp = $row[10];
	$hits = $row[12];
	$judul = $row[8];
	$nama = $row[2];
	$kota = $row[3];
	$web = $row[9];
	$telp = $row[13];
	$desc1 = $row[16];
	$nide = anti_injection($row[0]);
	//$sess = substr(str_shuffle(str_repeat("ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyz", 64)), 0, 64);
	//$token = md5(md5(date("j, n, Y")).md5($session).md5($sess));
	   	$conten = $row[4];
		$text = strip_tags($conten);
    	$isi = substr($text,0,75);
		$judule = strip_tags($judul);
		$jdl = substr($judule,0,100);
		
		$diskon=$row[17];
		$kodep=$row[18];
		$hargax=$row[15];
		$ready=$row[22];
	
	   $hargav=$hargax;
	
	
		if($diskon){
	$disce = ($diskon/100)*$hargav;
	$harga = $hargav-$disce;
	$price = rupiah($harga);
	$dscc = "<font style='font-size:8pt;line-height:150%;font-family:Arial;color:#FFFFFF; background-color:#FF3C3C; padding:2px; '>".$diskon."%</font>";
	}else{
	$harga = $hargav;
	$price = rupiah($harga);
	$dscc = "";
	}
		if ($ready > 0){
		$readyne = "<font style='font-weight:bold; color:#096'>".$ready." Barang</font>";
		$beline = "";	   
		}
		else
		{
		
		$readyne = "<font style='font-weight:bold; color:#F00'>Kosong</font>";
		$beline = " disabled='disabled'";	   
		} 
		
	   ?>
	    
  
  
  
  
  <div class="product">
    <div class="product-image">
      <?php echo $gambar;?>
    </div>
    <div class="product-details">
      <div class="product-title" style="font-family:Tahoma, Geneva, sans-serif; font-weight:bold; font-size:16px;"><a href="index.php?go=produk&page=detail&nid=<?php echo $nide;?>"><?php echo $judule;?></a></div>
      <p class="product-description" style="font-family:Tahoma, Geneva, sans-serif;font-size:12px;"><?php echo $isi;?><br /><br /><font style="font-size:14px;">Stock <?php echo $readyne;?></font></p>
    </div>
    <div class="product-price"><?php echo $price;?></div>
   <form action="cart_update.php" method="post" >
    <div class="product-quantity">
    
      
<input type="hidden" name="kode" value="<?php echo $kodep; ?>" />
	<input type="hidden" name="type" value="add" />
	<input type="hidden" name="return_url" value="<?php echo $current_url; ?>" />
    
      <input type="number" value="1" min="1" name="qty" style="width:50px;">
    </div>
    <div class="product-removal">
     
    
                   
     <button class="btn btn-success" <?php echo $beline; ?> id="add" onclick="$(this).closest('form').submit()" type="button" style="height:35px;">Buy</button>
       
                     	
      <a href="index.php?go=produk&page=detail&nid=<?php echo $nide;?>"><button class="btn btn-info" type="button">Detail</button></a>
      
    </div>
    </form>
  </div>
 
 <?php } 
 } else {
	echo "<p class='alert notification error'>-- Data yang anda cari tidak ditemukan --</p>";
}	
 ?>
 
 
 
</div>


	</div>
</div>
	</div>
</div>
<?php } ?>
	</div>
</div>