<?
error_reporting(E_ALL ^ (E_NOTICE | E_WARNING));
//***************************************************
// http://www.scriptindonesia.com
// Solusi Hemat Script Bisnis Online Anda
// Menerima Jasa Pembuatan Website & Template Website
//***************************************************
?>

<!-- GANTI PASSWORD AWAL -->
<!-- Info WebPro -->
 

<h6><font color="#549423"> </font></h6>
<hr />
<h3><font color="#FF0000">Password Anda</font></h3>
<h5><strong><?= $panggil ?> <font color="#0000FF"><?= $a[nama];?></font></strong> Yth,<br>
    Halaman ini untuk ganti password </h5>
<hr />

                    <div class="progress">
                        <div class="progress-bar progress-bar-success" role="progressbar" aria-valuenow="100" aria-valuemin="0" aria-valuemax="100" style="width: 100%;">
                            <span><?= $a[nama];?> - <?= $a[kota];?> - <?= $a[propinsi];?></span>
                        </div>
                    </div>

<!-- /. ROW  -->
<?php
function anti_injection($data){
  $filter = mysql_real_escape_string(stripslashes(strip_tags(htmlspecialchars($data,ENT_QUOTES))));
  return $filter;
}

$sql  = mysql_query("SELECT * FROM banner_kanan WHERE username='$_SESSION[user_session]' LIMIT 1");
$r    = mysql_fetch_array($sql);
?>

<? //AW1
switch ($page) {
	default :
?>

               <div class="row">
                <div class="col-md-12">
                    <!-- Form Elements -->
                    <div class="panel panel-default">
                        <div class="panel-heading">
                            Ganti Password Anda :
                        </div>
                        <div class="panel-body">
                            <div class="row">
                                <div class="col-md-6">
                                    <form role="form" method="post" action="?m=gantipass&page=send">

                                        <div class="form-group">
                                            <label>Password Lama : <font color="#FF0000">*</font></label>
                                            <input class="form-control" value="******" disabled />
                                        </div>

                                        <div class="form-group">
                                            <label>Input Password Baru : <font color="#FF0000">*</font></label>
                                            <input type="password" class="form-control" placeholder="Masukkan password baru" name="password1" maxlength="30"  />
                                        </div>

                                        <div class="form-group">
                                            <label>Ulangi Input Password Baru : <font color="#FF0000">*</font></label>
                                            <input type="password" class="form-control" placeholder="Ulangi masukkan password baru" name="password2" maxlength="30"  />
                                        </div>

                                        <input name="submit" type="submit" class="btn btn-danger" value="Ganti Password">
                                    </form>

        <? // AW2
	break;
	case send :
    
        $password1     = anti_injection($_POST['password1']);
        $password2     = anti_injection($_POST['password2']);

        if (strlen($password1) < 6) {
           echo "Password minimal 6 digit!. <br><a href=javascript:history.go(-1)>klik disini</a> untuk kembali";
           break;
        }

        if (strlen($password2) < 6) {
           echo "Ulangi password minimal 6 digit!. <br><a href=javascript:history.go(-1)>klik disini</a> untuk kembali";
           break;
        }

        if($password1 <> $password2)
        {
           echo "Input dan ulangi input password harus sama!. <br>Tekan tombol <b>BACK</b> pada browser Anda. <br>atau <a href=javascript:history.go(-1)>klik disini</a> untuk kembali";
           break;
           
        } else {

           if($password1 =='' or $password1 ==''){
              echo "Password tidak boleh kosong!. <br>Tekan tombol <b>BACK</b> pada browser Anda. <br>atau <a href=javascript:history.go(-1)>klik disini</a> untuk kembali";
              break;
           }

           //echo "oke";
        }
        $pswd1=$password1;$password1=$pswd1;
        mysql_query("UPDATE banner_kanan SET pass='$password1' WHERE username='$_SESSION[user_session]' ");
        
?>

                        <h3>Berhasil</h3>                         
                        Password Anda sudah diganti !<br>Selanjutnya gunakan password baru anda untuk login.<br><br>
                        <a href="?m=gantipass" class="btn btn-danger">Kembali</a>

<? // AW3
	break;
}
?>

                                </div>                                
                            </div>

                            <hr>
                            <br />

                            

                            <!--<img src="../images/logo.png" border="1"><br />-->
                           
                            <br /><br />

                        </div>
                    </div>
                     <!-- End Form Elements -->
                </div>
            </div>