<?
//*********************************************************************************
// Original Website By : Niadesain.com Di Jual melalui https://niadesain.com
// Please Call / SMS : 081384745483 (support@niadesain.com)
// Niadesain.com - Jasa Pembuatan Website Paling Murah dan Paling Lengkap
//*********************************************************************************
?>
<?
	if($user_status > 0) {
?>

<?
$user = $user_session;
$data = preg_replace("{NAMAMEMBER}", $user_nama, $data);
$data = preg_replace("{USERNAME}", $user, $data);
?>
<style type="text/css">
<!--
.style107 {font-size: 12px; font-weight: bold; font-family: Verdana, Arial, Helvetica, sans-serif; color: #000099; }
.ghtyuty {
	color: #FF0000;
	font-weight: bold;
}
img {
    max-width: 100%;
    height: auto;
}

 
.tydr6dghf {color: #0000FF}
.kuyi7id {color: #006600}
-->
</style>

  <div align="center">
    <p><font color="#FFFFFF"><strong><font color="#000066" size="2" face="Verdana, Arial, Helvetica, sans-serif"> PRODUK </font></strong></font></p>
  </div>
  <table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
    <tr bgcolor="#FFFFFF">
      <td height="35" colspan="3">&nbsp;</td>
    </tr>
    <tr>
      <td width="10" bgcolor="#FFFFFF">&nbsp;</td>
      <td><p align="center">
      
      <div id="module">
          <?
switch($page) {
default :
$db->select("id, title", "categories", "section='product' and id=57");
while($row=$db->fetch_row()) {
	//echo "<p>$row[1]</p>";
	$sql=mysql_query("select id, nama, harga, gambar, deskripsi, hit, poin, berat from product where catid='$row[0]'");
	?>
          <?
	$t=0;
	$n=0;
	while($data=mysql_fetch_row($sql)) {
		if($data[2] > 0) {
			$hg = rupiah($data[2]);
		} else {
			$hg = "<span style='color:#FF0000; font-size:14px'>FREE</span>";
		}		
    	if($n==0) {
		echo "<tr>";
		}   
      ?>
<div class="products_box">
  <table width="100%" border="0" cellspacing="0" cellpadding="0">
    <tbody>
      <tr>
        <th bgcolor="#FFFFE6" scope="col"><table width="95%" border="0" align="center" cellpadding="0" cellspacing="0" bordercolor="#CCCCCC">
          <tr>
            <td bgcolor="#FFFFE6"><div class="products_box">
              <?= "<p><b>$data[1]</b></p>"; ?>
              <p><img src="../images/news/<?= $data[3]; ?>" width="200" height="150" style="padding-right:2px"  /></p>
              <div class="products_box">
                <p>
                  <?= $db->crops($data[4], 20); ?>
                </p>
                </p>
                Harga: <span class="ghtyuty">
                  <?= $hg; ?>
                  </span><br>
                <div class="read_more_link">
                  <p><span class="style107"><a href="?m=download&amp;page=detil&amp;pid=<?= $data[0]; ?>"><img src="detail.png" width="75" height="25" border="0" /></a></span> &nbsp; &nbsp;&nbsp;&nbsp;&nbsp;<a href="?m=download&amp;page=unduh&amp;pid=<?= $data[0]; ?>"> </a><span class="style107"><a href="?m=download&amp;page=unduh&amp;pid=<?= $data[0]; ?>"><img src="beli.png" width="75" height="25" border="0" /></a></span></p>
                </div>
              </div>
              <?
		
                             
	
		
	
} //---end while	
//echo "</tr>";		
?>
              <p>&nbsp;</p>
            </div>
              <p>&nbsp;</p></td>
          </tr>
        </table></th>
      </tr>
    </tbody>
  </table>
</div>
          <?
    	//echo "<p>$data[1]</p>";
		
	//}
	echo "</fieldset>";	
	
}	
	break;
	
	case unduh :
		$db->select("id, nama, harga, gambar, deskripsi, hit, poin, berat", "product", "id='$pid'");
		$row=$db->fetch_row();
		
?>
          <table width="90%" border="0" align="center" cellpadding="5" cellspacing="0" class="bordertable">
            <tr class="tbl_header">
            </tr>
            <tr>
              <td><?
	   echo "<p><b>$row[1]</b></p>"; 
	   //--cek download--

	   if($ada > 1) { 
	   		if( isset($_POST['submit'])) {
			
				if($passdl == $db->result(0, "password")) {

					
				} else {
					echo "<p align=center><b>Password salah!</b></p>";
				}
			} else {			
	   
	   ?>
                  <form id="donlot" name="donlot" method="post" action="">
                    <table width="70%" border="0" align="center" cellpadding="5" cellspacing="1">
                      <tr>
                        <td width="50%" align="right">Password Download :</td>
                        <td width="50%"><input name="passdl" type="password" id="passdl" size="15" />
                            <input name="pid" type="hidden" id="pid" value="<?= $pid; ?>" size="15" /></td>
                      </tr>
                      <tr>
                        <td colspan="2" align="center"><input type="submit" name="submit" id="submit" value="DOWNLOAD" /></td>
                      </tr>
                    </table>
                  </form>
                <script language="JavaScript" type="text/javascript">
 var frmvalidator = new Validator("donlot");
 frmvalidator.addValidation("passdl","req","Masukkan password untuk download!");
          </script>
                  <?
			}
		} else {
				
		?>
                  <p>&nbsp;</p>
                <p><img src="../images/news/<?= $row[3]; ?>"  align="left" style="padding-right:2px" />
                      <?= $db->crops($row[4], 20); ?>
                </p>
                <p>Harga : <b>
                  <?
	   if($row[2] > 0) {
				$hg = rupiah($row[2]);
			$link = "?m=ewalet&amp;page=transfer";
			$tbl = "BELI";
	   echo $hg; ?>
                </b></p>
                <p><br />
                </p>
                <?
		} else {
			 $hg = "<span style='color:#FF0000; font-size:14px'>FREE</span>";
			 echo $hg;
			 $link = "download2.php?pid=$pid&download=resume";
			 $tbl = "DOWNLOAD";
		}
		?>
              </td>
            </tr>
            <tr>
              <td><form id="form1" name="form1" method="post" action="<?= $link; ?>">
                  <table width="100%" border="0" cellspacing="0" cellpadding="4">
                    <tr>
                      <td align="center"><?
			if($db->myewalet($user_session) <= $row[2]) {
			 	$dis = "";  
			} else {
				$dis = "disabled='disabled'";
			?>
<p style="color:#FF0000"> Saldo e-walet anda
                              belum mencukupi untuk membeli produk ini.<br />
                              Silahkan isi atau tambah saldo e-walet anda. </p>
                          <? 	
			}		
             ?>
			 <?
$kotanya = $db->dataku("kota", $user_session);
include "../ong-kir.php";
$hargax = $harga*$jumlah;
$ongkirx = $ongkirnya*$jumlah;
$tariff = $hargax + $ongkirx;
?>
                      </td></tr>
                    <tr>
                      <td width="50%" align="right"><p align="center"><span class="harga"><br>
                      </span><span class="harga">
<input name="tujuan" type="hidden" id="tujuan" value="admin" size="8" readonly="readonly" class="beli" />
                        </span>
                          <input name="ket" type="hidden" id="ket" value="Beli Product <?= $row[1]; ?>" size="8" readonly="readonly" class="beli" />
						  <input name="brt" type="hidden" id="brt" value="<?= $row[7]; ?>" size="8" readonly="readonly" class="beli" />
						  <input name="pnd" type="hidden" id="pnd" value="<?= $row[6]; ?>" size="8" readonly="readonly" class="beli" />
                          <input name="referrer" type="hidden" id="referrer" value="download" size="8" readonly="readonly" class="beli" />
                          <input name="harga" type="hidden" id="harga" value="<?= $row[2]; ?>" size="8" readonly="readonly" class="beli" />
                          <input name="goto" type="hidden" id="goto" value="download" size="8" readonly="readonly" class="beli" />
                          <input name="pid" type="hidden" id="pid" value="<?= $row[0]; ?>" size="8" readonly="readonly" class="beli" />
                          <br>
                          Jumlah :
                          <input type='number' name="jumlah" value='1' min='1'>
                          <br>
                          <input type="submit" name="button" id="button" value="<?= $tbl; ?>" class="tombole" <?= $dis; ?>/>
                        </p>
                      </td>
                    </tr>
                  </table>
              </form>
                  <?
	} //--end if udah beli
	?>
              </td>
            </tr>
          </table>
          <p>&nbsp;</p>
          <?	
	break;
	
	case detil :
	$db->select("id, nama, deskripsi, harga, gambar, poin, berat", "product", "id=$pid");
	$data = $db->fetch_row();
	?>
          <table width="90%" border="0" align="center" cellpadding="5" cellspacing="0">
            <tr class="tbl_produk">
              <td colspan="3"><h4>
                <?= $data[1]; ?>
              </h4></td>
            </tr>
            <tr>
              <td colspan="3"><p><img src="../images/news/<?= $data[4]; ?>" border="0" />
                  </p>
                <?= $data[2]; ?></td>
            </tr>
            <tr>
              <td width="50%" align="right">Harga : <b>
                <?= rupiah($data[3]); ?>
              </b></td>
              <td width="25%"><a href="?m=download&amp;page=unduh&amp;pid=<?= $data[0]; ?>"><img src="beli.png" width="75" height="25" border="0" /></a></td>
              <td width="25%"><a href="?m=download">Product List</a></td>
            </tr>
            <tr>
              <td colspan="3" align="center">&nbsp;</td>
            </tr>
          </table>
          <?    
	break;
	
}	
?>
        </div>
        </p>
        <p align="left">&nbsp; </p>
      </td>
      <td width="10" bgcolor="#FFFFFF">&nbsp;</td>
    </tr>
    <tr bgcolor="#FFFFFF">
      <td colspan="3">&nbsp;</td>
    </tr>
  </table>
  <p>&nbsp;</p>
  <p>&nbsp;</p>
  <p>    <?
} else {
	include "index0.php";
}
?>
  </p>
    </p>
</div>
</div>

  