<?
	if($user_status > 0 ) {
?>

<?
//*********************************************************************************
// Original Website By : Niadesain.com Di Jual melalui http://niadesain.com
// Please Call / SMS : 081384745483 (support@niadesain.com)
// Niadesain.com - Jasa Pembuatan Website Paling Murah dan Paling Lengkap
//*********************************************************************************
?>
<div id="module">
  <table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
    <tr>
      <td height="35" colspan="3"><div align="center"><font color="#FFFFFF"><strong><font color="#000066" size="2" face="Verdana, Arial, Helvetica, sans-serif">TRANSFER PIN </font></strong></font></div></td>
    </tr>
    <tr>
      <td width="10">&nbsp;</td>
      <td valign="top"><p align="left"><font size="2" face="Verdana, Arial, Helvetica, sans-serif">
        <?
switch ($page) {
	default :
?>
<?
	$sbl=mysql_query("select * from card where dealer2='$user_session' and status='0' order by id");
	$nom=1;
	$jml = 0;
	while($row=mysql_fetch_row($sbl)) {
		$jml = $jml + $row[9];
		$nom++;
	}
	?>
      </font></p>
        <p align="center">Rekan
              <?= $db->dataku("nama", $user_session); ?>
        Yth, Halaman ini untuk Transfer Pin ke sesama member </p>
        <form name="form1" method="post" action="?m=transfer-pin&page=transfer">
          <table width="95%"  border="0" align="center" cellpadding="4" cellspacing="0" class="bordertable">
            <tr>
              <td><div align="right"><font size="2" face="Verdana, Arial, Helvetica, sans-serif">Username Tujuan </font></div></td>
              <td><font size="2" face="Verdana, Arial, Helvetica, sans-serif">:<strong>
                <input name="dealer2" type="text" class="form" id="dealer2" size="30">
              </strong></font></td>
            </tr>
            <tr>
              <td><div align="right"><font size="2" face="Verdana, Arial, Helvetica, sans-serif">PIN</font></div></td>
              <td><font size="2" face="Verdana, Arial, Helvetica, sans-serif">:
                    <select name="nopin" id="nopin">
<?
	$sbl=mysql_query("select * from card where dealer2='$user_session' and status='0' order by id");
	$nom=1;
	$jml = 0;
	while($row=mysql_fetch_row($sbl)) {
			echo "<option value='$row[2]'>$row[2]</option>";

		}
		?>	
        </select>
              </font></td>
            </tr>
            <tr valign="top">
              <td align="center">&nbsp;</td>
              <td align="center">&nbsp;</td>
            </tr>
            <tr>
              <td>&nbsp;</td>
              <td><font size="2" face="Verdana, Arial, Helvetica, sans-serif">&nbsp;
                <input name="submit" type="submit" class="tombol" value="TRANSFER PIN">          </font></td>
            </tr>
            <tr>
              <td colspan="2"><font size="2" face="Verdana, Arial, Helvetica, sans-serif"><strong>Catatan :</strong><br>
                </font>
                  <ul>
                    <li><font size="2" face="Verdana, Arial, Helvetica, sans-serif">Pastikan username penerima sudah benar</font></li>
                </ul></td>
            </tr>
          </table>
          <p>
          <h2 align="center"><font color="#FF6633">TRANSFER HISTORY</font> </h2>
          <table width="100%" border="1" align="center" cellpadding="1" cellspacing="0">
            <tr bgcolor="#FFFF66" class="tbl_header">
              <td width="5%" align="center"><span class="style14"><strong>NO.</strong></span></td>
              <td width="16%" align="center"><span class="style14"><strong>TGL</strong></span></td>
              <td width="16%" align="center"><span class="style14"><strong>PIN</strong></span></td>
			  <td width="16%" align="center"><span class="style14"><strong>TRANSFER KE</strong></span></td>
              <td width="21%" align="center"><span class="style14"><strong>STATUS</strong></span></td>
            </tr>
            <?	
$db->select("tglminta, pinnya, status, tujuan", "transpin", "userid='$user_session'");
$nom=1;
while($row=$db->fetch_row()) {
	if(is_odd($nom) > 0) {
		$class = "tblrow_ganjil";
	} else {
		$class = "tblrow_genap";
	} 
	if($row[2] > 0) {
		$status = "<b>Sukses</b>";
	} else {
		$status = "Pending";
	}		
	echo "<tr class=$class>
       <td class='style6' align=center>$nom.</td>
       <td class='style6' align=center>".date("d-m-Y", strtotime($row[0]))."</td>
       <td class='style6' align=center>$row[1]</td>
	   <td class='style6' align=center>$row[3]</td>
	    <td class='style6' align=center>$status</td>
     </tr>";
	 $nom++;
	 }
?>
      </table>  </p>
        </form>        <p align="left"><font size="2" face="Verdana, Arial, Helvetica, sans-serif">
        <?
	break;
	
	case transfer:
	$db->update("card", "dealer2 = '$dealer2' WHERE pin = '$nopin' AND dealer2 = '$user_session'");
	$db->insert("transpin", "", "'', '$user_session', '$clientdate', '$nopin', '1', '$dealer2'");
	
?>
</font></p>
        <div id="notice">
          <div align="center"><font color="#000066" size="5" face="Verdana, Arial, Helvetica, sans-serif"><strong>PIN Berhasil ditransfer! </strong></font></div>
        </div>
        <p align="center"><font size="2" face="Verdana, Arial, Helvetica, sans-serif"><a href="?m=transfer-pin">Klik di sini untuk kembali</a></font></p>        
        <p><font size="2" face="Verdana, Arial, Helvetica, sans-serif">
          <?
	break;
}
?>
        </font></p>
      <p align="center">&nbsp;</p></td>
      <td width="10">&nbsp;</td>
    </tr>
    <tr>
      <td colspan="3">&nbsp;</td>
    </tr>
  </table>
  <h3 align="center">&nbsp;</h3>
  <h3 align="center">&nbsp;</h3>
  <font size="2" face="Verdana, Arial, Helvetica, sans-serif">  </font>
  <font size="2" face="Verdana, Arial, Helvetica, sans-serif">  </font>
<div id="notice"> 
    <div align="center"></div>
  </div>
  <font size="2" face="Verdana, Arial, Helvetica, sans-serif"></font></div>
<?
} else {
echo "<meta http-equiv=\"refresh\" content=\"1; url=illegal.html\">";
}
?>