<?
//***************************************************
// http://www.scriptindonesia.com
// Solusi Hemat Script Bisnis Online Anda
// Menerima Jasa Pembuatan Website & Template Website
//***************************************************
?>
<?
//Edit Script AW 20160221
//if (session_is_registered("valid_admin")) {
  if (isset($_SESSION['valid_admin'])) {
?>

<title>Ganti Password - Admin</title>
<?
if($page == "ganti") {

?>
<style type="text/css">
<!--
.style1 {
	font-size: 10px;
	font-family: Verdana, Arial, Helvetica, sans-serif;
	color: #FF0000;
}
-->
</style>

<script type="text/javascript">
			function scriptindonesiavalidasi(form){
                                if (form.password1.value == ""){ alert("Anda belum mengisikan : Password Baru"); form.password1.focus(); return (false); }
                                var mincar = 6;
                                if (form.password1.value.length < mincar){ alert("Password baru minimal 6 digit. silahkan coba lagi..."); form.password1.focus(); return (false); }

                                if (form.password2.value == ""){ alert("Anda belum mengisikan : Password Baru ke2 "); form.password2.focus(); return (false); }
                                var mincar = 6;
                                if (form.password2.value.length < mincar){ alert("Password baru ke2 minimal 6 digit. silahkan coba lagi..."); form.password2.focus(); return (false); }

                        return (true);
			}

</script>

<table width="100%" border="0" cellpadding="2" cellspacing="0" bgcolor="#bfd6ed">
  <tr>
    <td width="100%" height="2" bgcolor="#333333">
    </td>
  </tr>
</table>

<table width="100%" border="0" cellpadding="2" cellspacing="0" bgcolor="#bfd6ed">
  <tr>
    <td width="100%" height="2" bgcolor="#333333">
        <!-- ------------------------------------- -->
        <div id="menu_button2" align="center">
            <strong><font color="#ffffff"><?= $db->config("bank2") ?></font></strong>
        </div>
        <!-- ------------------------------------- -->
    </td>
  </tr>
</table>

<table width="100%" border="0" align="center" cellpadding="2" cellspacing="0">
  <tr>
    <td height="30" bgcolor="#8c759a"><div align="center"><span class="title">&nbsp;&nbsp;<strong><u>Ganti Password  Admin</u></strong><u></u></span></div></td>
  </tr>
  <tr>
    <td width="956" bgcolor="#EF9400"><img src="" width="1" height="1" alt="" border="0"></td>
  </tr>

  <tr>
    <td><p>&nbsp;</p>
      <table width="90%" border="0" align="center" cellpadding="3" cellspacing="1" class="kotak">
        <tr>
          <td align="center"><b>Ganti Password</b></td>
        </tr>
        <tr>
          <td><form method="post" action="?m=changepass&page=send" onSubmit="return scriptindonesiavalidasi(this)">
              <table border="0" align="center" class="bodytext">
                <tr>
                  <td>Masukkan password baru</td>
                  <td>:</td>
                  <td><input maxlength="50" type="password" name="password1" class="form2"> *min : 6 digit</td> <!-- required="required"-->
                </tr>
                <tr>
                  <td>Masukkan kembali password baru</td>
                  <td>:</td>
                  <td><input maxlength="50" type="password" name="password2" class="form2"> *min : 6 digit</td> <!-- required="required"-->
                </tr>
              </table>
              <div align="center">
                <p> 
                  <input type="submit" name="Submit" value=" GANTI PASSWORD " class="tombol2">
                </p>
                </div>
          </form></td>
        </tr>
        <tr>
          <td><div align="center" class="style1"></div></td>
        </tr>
      </table>
      <p>&nbsp;</p>
      <?
}

if($page == "send") {
if($password1 <> $password2)
			{
				//include "html_opening.html";
				?>
      <br /><br />
      <table width="90%" border="0" align="center" cellpadding="3" cellspacing="1" bgcolor="#EAE9FE" class="kotak">
        <tr>
            <td align="center"><h2><b>Ganti Password</b></h2></td>
        </tr>
        <tr>
          <td align="center" style="font-weight:bold; color:#FF0000">Kedua password harus sama!. Tekan tombol <b>BACK</b> pada browser Anda.</td>
        </tr>
        <tr>
          <td>&nbsp;</td>
        </tr>
      </table>
      <?php
				//include "html_closing.html";
			}
			else
			{
				//$pswd=($password1);
                                $pswd=base64_encode($password1);
				$db->update("admin", "pass='$pswd'", "userid='$valid_admin'");
			
				
				//include "html_opening.html";
				?>
      <br /><br />
      <table width="90%" border="0" align="center" cellpadding="3" cellspacing="1" bgcolor="#EAE9FE" class="kotak">
        <tr>
          <td align="center"><h2><b>Ganti Password</b></h2></td>
        </tr>
        <tr>
          <td align="center" style="font-weight:bold; color:#0000FF">Password Anda sudah diganti. Gunakan password baru anda untuk login selanjutnya.</td>
        </tr>
        <tr>
          <td>&nbsp;</td>
        </tr>
      </table>
      <?php
				//include "html_closing.html";
			}
}
?>
      <p align="center">&nbsp;</p>
    <p></p></td>
  </tr>
</table>
<?
} else {
echo "<meta http-equiv=\"refresh\" content=\"1; url=illegal.html\">";
}
?>