<?
	 if (isset($_SESSION['valid_admin'])) {
?>

<?
//*********************************************************************************
// 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
//*********************************************************************************
?>
<script type="text/javascript">
<!--
function confirmation(noid) {
	var answer = confirm("Are You sure to delete this Article?")
	if (answer){
		//alert("Bye bye!")
		window.location = "?m=content&page=delete&no=" + noid;
		
	}
	
}
//-->
</script>
<h2><img src="images/icon-48-article.png" width="48" height="48" align="absmiddle"> Konfigurasi Sistem </h2>
<?
switch($page) {
	default :
	$db->select("title, googleverifi, description, keyword, footer, marque, tentang, name, email, domain, alamat, hpsms, bank, bank1, bank2, potpph, potadmin, potstok, minstok, minwd, biaya, komisi_sponsor, kompasangan, komgenerasi, komlev, komjual,  reward1, reward2, reward3, reward4, reward5, reward6, reward7, reward8, ki1, ki2, ki3, ki4, ki5, ki6, ki7, ki8, ka1, ka2, ka3, ka4, ka5, ka6, ka7, ka8,  kedalaman, ym, flushout", "configuration", "id=1");
	$by = explode("|", $db->result(0, "biaya"));
	$biaya1 = $by[0];
	$kgen = explode("|", $db->result(0, "komgenerasi"));
	$komgen = $kgen[0];
	$komgen2 = $kgen[1];
	$komgen3 = $kgen[2];
	$komgen4 = $kgen[3];
	$komgen5 = $kgen[4];

		if($act == 1 or $act) {
?>
<div id="notice"><img src="images/notice-info.png" width="29" height="29" align="absmiddle" />Data telah berhasil diupdate ! </div>
	<?
	}
	?>
<form id="form2" name="form2" method="post" action="?m=configuration2&dj=10&amp;page=submit">
  <table width="80%" border="0" align="center" cellpadding="4" cellspacing="1">
    <tr class="tbl_header">
      <td colspan="2">Web Config</td>
    </tr>
    <tr>
      <td align="right">Tittle / Judul Website  : </td>
      <td><label>
        <input name="title" type="text" id="title" value="<?= $db->result(0, "title"); ?>" size="60" />
        <input name="no" type="hidden" id="no" value="1" size="10" />
      </label></td>
    </tr>
    <tr class="">
      <td bgcolor="#FFFF99"><div align="right">Google Site Verification   : </div></td>
      <td bgcolor="#FFFF99"><input name="googleverifi" type="text" id="googleverifi" value="<?= $db->result(0, "googleverifi"); ?>" size="60" />
          <em><a href="https://www.google.com/webmasters" target="_blank">Klik disini Utk mendapatkan</a> </em></td>
    </tr>
    <tr>
      <td align="right" valign="top">Deskripsi : </td>
      <td valign="top"><textarea name="description" cols="60" rows="3" id="description"><?= $db->result(0, "description"); ?>
    </textarea></td>
    </tr>
    <tr>
      <td align="right" valign="top">Keyword :</td>
      <td valign="top"><textarea name="keyword" cols="60" rows="3" id="keyword"><?= $db->result(0, "keyword"); ?>
    </textarea></td>
    </tr>
    <tr>
      <td align="right" valign="top">Footer :</td>
      <td valign="top"><textarea name="footer" cols="60" rows="3"><?= $db->result(0, "footer"); ?>
    </textarea></td>
    </tr>
    <tr class="tbl_header">
      <td colspan="2" bgcolor="#FFFF99"><div align="center">PENGATURAN PEMILIK WEBSITE </div></td>
    </tr>
    <tr>
      <td width="37%" align="right">Nama :</td>
      <td width="63%"><input name="name" type="text" id="name" value="<?= $db->result(0, "name"); ?>" size="40" />
          <input name="no" type="hidden" id="no" value="1" size="10" /></td>
    </tr>
    <tr>
      <td align="right">E-mail :</td>
      <td><input name="email" type="text" id="email" value="<?= $db->result(0, "email"); ?>" size="40" /></td>
    </tr>
    <tr>
      <td align="right">Nama Website  :</td>
      <td><input name="domaine" type="text" id="domaine" value="<?= $db->result(0, "domain"); ?>" size="40" />
        *www.domain.com </td>
    </tr>
    <tr>
      <td align="right" valign="top">Alamat Lengkap :</td>
      <td><textarea name="alamat" cols="40" rows="4" id="alamat"><?= $db->result(0, "alamat"); ?>
  </textarea></td>
    </tr>
    <tr>
      <td align="right">Telepon/HP/SMS :</td>
      <td><input name="hpsms" type="text" id="hpsms" value="<?= $db->result(0, "hpsms"); ?>" size="40" /></td>
    </tr>
	  <tr>
      <td align="right">WhatsApp (pakai 62) :</td>
      <td><input name="ym" type="text" id="ym" value="<?= $db->result(0, "ym"); ?>" size="40" /></td>
    </tr>
    <tr>
      <td align="right" valign="top">Data Bank 1 :<br />
        (ditulis lengkap dengan nama bank, no. rekening &amp; nama pemilik rekening) </td>
      <td><textarea name="bank" cols="40" rows="3" id="bank"><?= $db->result(0, "bank"); ?>
  </textarea></td>
    </tr>
    <tr>
      <td align="right" valign="top">Data Bank 2 :<br />
        (ditulis lengkap dengan nama bank, no. rekening &amp; nama pemilik rekening) </td>
      <td><textarea name="bank1" cols="40" rows="3" id="bank1"><?= $db->result(0, "bank1"); ?>
  </textarea></td>
    </tr>
    <tr>
      <td align="right" valign="top">Data Bank 3 :<br />
        (ditulis lengkap dengan nama bank, no. rekening &amp; nama pemilik rekening) </td>
      <td><textarea name="bank2" cols="40" rows="3" id="bank2"><?= $db->result(0, "bank2"); ?>
  </textarea></td>
    </tr>
    <tr class="tbl_header">
      <td colspan="2" bgcolor="#FFFF99"><div align="center">PENGATURAN POTONGAN DAN MINIMAL WITHDRAW </div></td>
    </tr>
    <tr>
      <td align="right">Biaya Transfer :</td>
      <td><input name="potadmin" type="text" id="potadmin" value="<?= $db->result(0, "potadmin"); ?>" size="10" />
        (ditulis tanpa tanda baca) </td>
    </tr>
    <tr>
      <td align="right">PPH/Pajak :</td>
      <td><input name="potpph" type="text" id="potpph" value="<?= $db->result(0, "potpph"); ?>" size="10" />
        % </td>
    </tr>
    <tr>
      <td align="right">Minimal Withdraw  :</td>
      <td><input name="minwd" type="text" id="minwd" value="<?= $db->result(0, "minwd"); ?>" size="10" />
        (ditulis tanpa tanda baca) </td>
    </tr>
    <tr class="tbl_header">
      <td colspan="2" bgcolor="#FFFF99"><div align="center">PENGATURAN BIAYA DAN KOMISI SPONSOR </div></td>
    </tr>
    <tr>
      <td align="right">Biaya Pendaftaran :</td>
      <td><input name="biaya1" type="text" id="biaya1" value="<?= $biaya1; ?>" size="10" />
        (ditulis tanpa tanda baca) </td>
    </tr>
    <tr>
      <td align="right">Komisi Sponsor :</td>
      <td><input name="k_sponsor" type="text" id="k_sponsor" value="<?= $db->result(0, "komisi_sponsor"); ?>" size="10" />
        (ditulis tanpa tanda baca) </td>
    </tr>
    <tr class="tbl_header">
      <td colspan="2" bgcolor="#FFFF99"><div align="center">PENGATURAN STOKIS</div></td>
    </tr>
    <tr>
      <td align="right">Minimal Order PIN  :</td>
      <td><input name="minstok" type="text" id="minstok" value="<?= $db->result(0, "minstok"); ?>" size="10" />
        (ditulis tanpa tanda baca) </td>
    </tr>
    <tr>
      <td align="right">Potongan Stokis   :</td>
      <td><input name="potstok" type="text" id="potstok" value="<?= $db->result(0, "potstok"); ?>" size="10" />
        %</td>
    </tr>
    <tr class="tbl_header">
      <td colspan="2" align="center" bgcolor="#FFFF99">REWARD BERDASARKAN JUMLAH TITIK </td>
    </tr>
    <tr>
      <td align="center"><div align="right">Reward-1 :</div></td>
      <td align="center"><div align="left">
          <input name="reward1" type="text" id="reward1" value="<?= $db->result(0, "reward1"); ?>" size="30" />
        Syarat
        <input name="ki1" type="text" id="ki1" value="<?= $db->result(0, "ki1"); ?>" size="10" />
        Kanan
        <input name="ka1" type="text" id="ka1" value="<?= $db->result(0, "ka1"); ?>" size="10" />
      </div></td>
    </tr>
    <tr>
      <td align="center"><div align="right">Reward-2 :</div></td>
      <td align="center"><div align="left">
          <input name="reward2" type="text" id="reward2" value="<?= $db->result(0, "reward2"); ?>" size="30" />
        Syarat
        <input name="ki2" type="text" id="ki2" value="<?= $db->result(0, "ki2"); ?>" size="10" />
        Kanan
        <input name="ka2" type="text" id="ka2" value="<?= $db->result(0, "ka2"); ?>" size="10" />
      </div></td>
    </tr>
    <tr>
      <td align="center"><div align="right">Reward-3 :</div></td>
      <td align="center"><div align="left">
          <input name="reward3" type="text" id="reward3" value="<?= $db->result(0, "reward3"); ?>" size="30" />
        Syarat
        <input name="ki3" type="text" id="ki3" value="<?= $db->result(0, "ki3"); ?>" size="10" />
        Kanan
        <input name="ka3" type="text" id="ka3" value="<?= $db->result(0, "ka3"); ?>" size="10" />
      </div></td>
    </tr>
    <tr>
      <td align="center"><div align="right">Reward-4 :</div></td>
      <td align="center"><div align="left">
          <input name="reward4" type="text" id="reward4" value="<?= $db->result(0, "reward4"); ?>" size="30" />
        Syarat
        <input name="ki4" type="text" id="ki4" value="<?= $db->result(0, "ki4"); ?>" size="10" />
        Kanan
        <input name="ka4" type="text" id="ka4" value="<?= $db->result(0, "ka4"); ?>" size="10" />
      </div></td>
    </tr>
    <tr>
      <td align="center"><div align="right">Reward-5 :</div></td>
      <td align="center"><div align="left">
          <input name="reward5" type="text" id="reward5" value="<?= $db->result(0, "reward5"); ?>" size="30" />
        Syarat
        <input name="ki5" type="text" id="ki5" value="<?= $db->result(0, "ki5"); ?>" size="10" />
        Kanan
        <input name="ka5" type="text" id="ka5" value="<?= $db->result(0, "ka5"); ?>" size="10" />
      </div></td>
    </tr>
    <tr>
      <td align="center"><div align="right">Reward-6 :</div></td>
      <td align="center"><div align="left">
          <input name="reward6" type="text" id="reward6" value="<?= $db->result(0, "reward6"); ?>" size="30" />
        Syarat
        <input name="ki6" type="text" id="ki6" value="<?= $db->result(0, "ki6"); ?>" size="10" />
        Kanan
        <input name="ka6" type="text" id="ka6" value="<?= $db->result(0, "ka6"); ?>" size="10" />
      </div></td>
    </tr>
    <tr>
      <td align="center"><div align="right">Reward-7 :</div></td>
      <td align="center"><div align="left">
          <input name="reward7" type="text" id="reward7" value="<?= $db->result(0, "reward7"); ?>" size="30" />
        Syarat
        <input name="ki7" type="text" id="ki7" value="<?= $db->result(0, "ki7"); ?>" size="10" />
        Kanan
        <input name="ka7" type="text" id="ka7" value="<?= $db->result(0, "ka7"); ?>" size="10" />
      </div></td>
    </tr>
    <tr>
      <td align="center"><div align="right">Reward-8 :</div></td>
      <td align="center"><div align="left">
          <input name="reward8" type="text" id="reward8" value="<?= $db->result(0, "reward8"); ?>" size="30" />
        Syarat
        <input name="ki8" type="text" id="ki8" value="<?= $db->result(0, "ki8"); ?>" size="10" />
        Kanan
        <input name="ka8" type="text" id="ka8" value="<?= $db->result(0, "ka8"); ?>" size="10" />
      </div></td>
    </tr>
    <tr class="tbl_header">
      <td colspan="2" align="center" bgcolor="#F8ED88">KOMISI LEVEL DAN KONDISI MATRIX </td>
    </tr>
    <tr class="tbl_header">
      <td colspan="2" align="center" style="color: #EF0B0F">&nbsp; </td>
    </tr>
    <tr>
      <td colspan="2" align="center">System Bisnis Matrix 2 x
        <label>
          <select name="kedalaman" id="kedalaman" onchange="location =  this.options[this.selectedIndex].value">
            <?
		$lv = 25;
		$kdlm = explode("|", $db->result(0, "kedalaman"));
		$kd = $kdlm[0];
		for($i=1;$i<=$lv;$i++) {
			if($kd == $d or !$d) {
				$kd = $kd;
			} else {
				$kd = $d;
			}
			if($d == $i or $kd == $i) {
				$sel = "selected=selected";
			} else {
				$sel = "";
			}		
			echo "<option value='?m=configuration2&d=$i&dj=10' $sel>$i</option>";
		}
		?>
          </select>
          Level</label></td>
    </tr>
    <?
   $klev = $db->result(0, "komlev");
   
	if($kd == $d or !$d) {
		$kd = $kd;
	} else {
		$kd = $d;
	}
 //  if($pg == "komlev");
   	for($i=0;$i<$kd;$i++) {
		$komlev = explode("|", $klev); 
		$x = $i+1;
?>
    <tr>
      <td align="right">Komisi Level
        <?= $x; ?>
        :</td>
      <td><input name="<?= "komlev$i"; ?>" type="text" value="<?= $komlev[$i]; ?>" size="10" />
      </td>
    </tr>
    <?
	}
//	}
?>
    <tr class="tbl_header">
      <td colspan="2" align="center" bgcolor="#FFFF99">KOMISI PENJUALAN </td>
    </tr>
    <tr>
      <td colspan="2" align="center">Kedalaman sampai dengan Level :
        <label>
          <select name="kedalaman1" id="kedalaman1" onchange="location =  this.options[this.selectedIndex].value">
            <?
		$lv = 10;
		
		$kde = $kdlm[1];
		for($j=1;$j<=$lv;$j++) {
			if($kde == $dj or !$dj) {
				$kde = $kde;
			} else {
				$kde = $dj;
			}
			if($dj == $j or $kde == $j) {
				$sel = "selected=selected";
			} else {
				$sel = "";
			}		
			echo "<option value='?m=configuration2&dj=$j' $sel>$j</option>";
		}
		?>
          </select>
        </label></td>
    </tr>
    <?
   $kjual = $db->result(0, "komjual");
   
	if($kde == $dj or !$dj) {
		$kde = $kde;
	} else {
		$kde = $dj;
	}
 //  if($pg == "komlev");
   	for($i=0;$i<$kde;$i++) {
		$komjual = explode("|", $kjual); 
		$x = $i+1;
?>
    <tr>
      <td align="right">Komisi Penjualan Level
        <?= $x; ?>
        :</td>
      <td><input name="<?= "komjual$i"; ?>" type="text" value="<?= $komjual[$i]; ?>" size="4" />
        % </td>
    </tr>
    <?
	}
//	}
?>
    <tr>
      <td colspan="2">&nbsp;</td>
    </tr>
    <tr>
      <td colspan="2"><input name="level" type="hidden" value="<?= $kd; ?>" size="10" />
          <input name="levelewalet" type="hidden" value="<?= $kd1; ?>" size="10" />
          <label>
          <input name="submit" type="submit" class="button"  value="SAVE">
          </label>
          <label>
          <input type="button" name="cancel" id="cancel" value="CANCEL" onClick="javascript:history.go(-1)" class="cancelbutton">
        </label></td>
    </tr>
  </table>
</form>
<p>&nbsp;</p>
<?
	break;
	
	case submit :
		
			$komlev = "$komlev0|$komlev1|$komlev2|$komlev3|$komlev4|$komlev5|$komlev6|$komlev7|$komlev8|$komlev9|$komlev10|$komlev11|$komlev12|$komlev13|$komlev14|$komlev15|$komlev16|$komlev17|$komlev18|$komlev19|$komlev20|$komlev21|$komlev22|$komlev23|$komlev24";
			$kom_gen = "$komgen|$komgen2|$komgen3|$komgen4|$komgen5";
			$komjual = "$komjual0|$komjual1|$komjual2|$komjual3|$komjual4|$komjual5|$komjual6|$komjual7|$komjual8|$komjual9|$komjual10";
			$biaya = "$biaya1";
			$kdlman = "$level";
			$db->update("configuration", "title='$title', googleverifi='$googleverifi', description='$description', keyword='$keyword', footer='$footer', marque='$marque', tentang='$tentang', name='$name', email='$email', domain='$domaine', alamat='$alamat', hpsms='$hpsms', bank='$bank', bank1='$bank1', bank2='$bank2', potpph='$potpph', potadmin='$potadmin', potstok='$potstok', minstok='$minstok', minwd='$minwd',  biaya='$biaya',  komisi_sponsor='$k_sponsor', kompasangan='$kompasangan', komgenerasi='$kom_gen', komlev='$komlev', komjual='$komjual', reward1='$reward1', reward2='$reward2', reward3='$reward3', reward4='$reward4', reward5='$reward5', reward6='$reward6', reward7='$reward7', reward8='$reward8', ki1='$ki1', ki2='$ki2', ki3='$ki3', ki4='$ki4', ki5='$ki5', ki6='$ki6', ki7='$ki7', ki8='$ki8', ka1='$ka1', ka2='$ka2', ka3='$ka3', ka4='$ka4', ka5='$ka5', ka6='$ka6', ka7='$ka7', ka8='$ka8', kedalaman='$kdlman', ym='$ym', flushout='$flushout'", "id='$no'");
	//echo $komlev;
			echo "<meta http-equiv='refresh' content='0;URL=?m=configuration2&dj=10&act=1'>";
	break;
	
	case publish :
		$db->update("content", "published='$pub'", "id='$no'");
		echo "<meta http-equiv='refresh' content='0;URL=?m=content'>";
	break;
	case delete :
		//echo "delete no $no";
		$db->delete("content", "id=$no");
		echo "<meta http-equiv='refresh' content='0;URL=?m=content'>";
	break;	
	
	case frontpage :
		$db->update("content", "frontpage='$pub'", "id='$no'");
		echo "<meta http-equiv='refresh' content='0;URL=?m=content'>";
	break;
}
?>	
<?
} else {
echo "<meta http-equiv=\"refresh\" content=\"1; url=illegal.html\">";
}
?>