<?php ob_start(); ?>
<?php
if (basename($_SERVER['SCRIPT_FILENAME']) == basename(__FILE__)){
echo "<p align=center><br><br><br><br><br><br><font size=\"6\" color=\"#FF0000\">ILLEGAL ACCESS !!";
echo "<meta http-equiv=\"refresh\" content=\"2; url=../index.php\">";
exit();} 
// // #-----------------------------------------------------------------------------#
// // #-------------------------------.*PRIMADESAIN*.-------------------------------#
// // #-------------------------------: Script MMM3 :-------------------------------#
// // #------------------- Copyright 2009-2015 Primadesain.com ---------------------#
// // #----------- Email: primapc57@gmail.com Phone: +62 852 2865 7360 -------------#
// // #--------- http://www.primadesain.com - http://www.primadesain.net -----------#
// // #-----------------------------------------------------------------------------#
// // #------------- Primadesain.Com | Jasa Webdesain Bisnis Online ----------------#
// // #--- Website Bisnis MLM, Bisnis Investasi, Forex, Hyip, Binary, Trinary, -----#
// // #------- Matrix 4 -- 10, Toko Online, Iklan Baris, Profil, Reseller. ---------#
// // #-----------------------------------------------------------------------------#
// // # This software is  furnished  under a  license and may  be used and   copied #
// // # only  in accordance with the terms of such  license and with  the inclusion #
// // # of  the above copyright notice.  This software or any other  copies thereof #
// // # may not be  provided or otherwise made available  to any other person.   No #
// // # title to and  ownership of the software is hereby transferred.              #
// // #                                                                             #
// // # You  may  not  reverse   engineer,  decompile,  defeat  license  encryption #
// // # mechanisms, or  disassemble  this  software  product  or software   product #
// // # license. We  may terminate  this license if you  don't comply  with any  of #
// // # the terms and   conditions set forth   in our  End  User  License Agreement #
// // # (EULA). In  such event, licensee  agrees to return licensor or  destroy all #
// // # copies of software upon termination  of the license.                        #
// // # Please see the EULA file for the full End User License Agreement.           #
// // ###############################################################################
?>

<?php
if($db->dataku("status", $user_session) == 0 || $db->dataku("blokir", $user_session) == 1) {
echo "<div class='alert alert-danger alert-dismissable'><button type='button' class='close' data-dismiss='alert' aria-hidden='true'></button>".$LANG["status0"]."</div>";
}else{
?>
      <?
if(isset($_POST['changepass'])){
	
	$passwordx = $_POST['passwordx'];

	$passworde=md5($passwordx);
    $db->select("pass", "member", "pass='$passworde' and username='$user_session'");
    if ($db->num_rows() > 0) {
	
	
	$ipne = $_SERVER['REMOTE_ADDR'];
	
	$user = $user_session;
	$pass1 = anti_injection($_POST["password1"]);
	$pass2 = anti_injection($_POST["password2"]);


	if(!$pass1 || !$pass2){	
		header("location: ?go=gantipass&result=wrong_pass");
		exit;
		} else {
		if($pass1 <> $pass2)
			{
			header("location: ?go=gantipass&result=wrong_pass");
			exit;

		} else {	
	

			
$pswd=md5($pass1);
			$db->update("member", "pass='$pswd'", "username='$user_session'");
			$db->update("acc", "pass='$pass1'", "username='$user_session'");

$nama = $db->dataku("nama", $user_session);
		$email = $db->dataku("email", $user_session);
		$tgl = formatgl($clientdate);
		$waktu = date("H:i:s");
		$hostaddress = gethostbyaddr($_SERVER['REMOTE_ADDR']);

$mail = new PHPMailer(); // defaults to using php "mail()"
$data = $mail_reset_password_isi;
	$data = preg_replace("/{users2}/", $user, $data);			
    $data = preg_replace("/{pass1}/", $pass1, $data);
    $data = preg_replace("/{tgl}/", $tgl, $data);
    $data = preg_replace("/{waktu}/", $waktu, $data);	
    $data = preg_replace("/{ipne}/", $ipne, $data);	
    $data = preg_replace("/{nama}/", $nama, $data);
	$data = preg_replace("/{hpadmin}/", $hpadmin, $data);			
    $data = preg_replace("/{alamatadmin}/", $alamatadmin, $data);
    $data = preg_replace("/{contactpage}/", $contactpage, $data);
    $data = preg_replace("/{login}/", $login, $data);
    $data = preg_replace("/{bisnisname}/", $bisnisname, $data);
    $data = preg_replace("/{logomail}/", $logomail, $data);
    $data = preg_replace("/{logourl}/", $logourl, $data);
    $data = preg_replace("/{emailadmin}/", $emailadmin, $data);
	$body = $data;
	
	$datax = $mail_reset_password_subject;
	$datax = preg_replace("/{nama}/", $nama, $datax);	
    $datax = preg_replace("/{bisnisname}/", $bisnisname, $datax);	
	$subject_reset_password = $datax;

if($mailset == 1){	
$mail->IsSMTP(); // telling the class to use SMTP
$mail->Host       = $smtphost; // SMTP server
$mail->SMTPAuth   = true;                  // enable SMTP authentication
$mail->Host       = $smtphost; // sets the SMTP server
$mail->Port       = $smtport;                    // set the SMTP port for the GMAIL server
$mail->Username   = $smtpuser; // SMTP account username
$mail->Password   = $smtpass;        // SMTP account password
}
$mail->SetFrom(''.$emailadmin.'', ''.$bisnisname.'');
	$address = $email;
	$mail->AddAddress($address, "".$nama."");
	$mail->IsHTML(true);      
	$mail->Subject    = "".$subject_reset_password."";
	$mail->AltBody    = "Pesan HTML, Untuk melihat pesan, silakan menggunakan peninjau HTML email yang kompatibel!"; // Alt Body
	$mail->MsgHTML($body);

$mail->Send();
		
		header("location: ?go=gantipass&result=success");
			exit;

}	
	}
	} else {

	
	header("location: ?go=gantipass&result=wrong_passx");
	exit;

	}
?>
<?php
} else {
?>

<div class="col-md-9">
 <?php
 if(isset($_GET['result'])&&$_GET['result']=="success"){
echo "<div class='alert alert-success alert-dismissable'><button type='button' class='close' data-dismiss='alert' aria-hidden='true'></button>".$LANG["changepassok"]."</div>";
}
?>
 <?php
 if(isset($_GET['result'])&&$_GET['result']=="wrong_pass"){
echo "<div class='alert alert-danger alert-dismissable'><button type='button' class='close' data-dismiss='alert' aria-hidden='true'></button>".$LANG["wrongnew"]."</div>";
}
?>

 <?php
 if(isset($_GET['result'])&&$_GET['result']=="wrong_passx"){
echo "<div class='alert alert-danger alert-dismissable'><button type='button' class='close' data-dismiss='alert' aria-hidden='true'></button>".$LANG["wrongold"]."</div>";
}
?>

  <?php
 if(isset($_GET['result'])&&$_GET['result']=="wrong_code"){
echo "<div class='alert alert-danger alert-dismissable'><button type='button' class='close' data-dismiss='alert' aria-hidden='true'></button>".$LANG["wrongsmscode"]."</div>";
}
?>



 <?php
 if(isset($_GET['result'])&&$_GET['result']=="no_pin"){
echo "<div class='alert alert-danger alert-dismissable'><button type='button' class='close' data-dismiss='alert' aria-hidden='true'></button>".LANG_FORGOT_NO_PIN."</div>";
}
?>  
 <?php
 if(isset($_GET['result'])&&$_GET['result']=="wrong_pin"){
echo "<div class='alert alert-danger alert-dismissable'><button type='button' class='close' data-dismiss='alert' aria-hidden='true'></button>".LANG_FORGOT_WRONG_PIN."</div>";
}
?>  
 <?php
 if(isset($_GET['result'])&&$_GET['result']=="pin_lock"){
echo "<div class='alert alert-danger alert-dismissable'><button type='button' class='close' data-dismiss='alert' aria-hidden='true'></button>".LANG_FORGOT_BLOCK_PIN."</div>";
}
?>  

 <?php
 if(isset($_GET['result'])&&$_GET['result']=="pin_off"){
echo "<div class='alert alert-danger alert-dismissable'><button type='button' class='close' data-dismiss='alert' aria-hidden='true'></button>".LANG_FORGOT_OFF_PIN."</div>";
}
?>  

  <?php
 if(isset($_GET['result'])&&$_GET['result']=="wrong_captcha"){
echo "<div class='alert alert-danger alert-dismissable'><button type='button' class='close' data-dismiss='alert' aria-hidden='true'></button>".LANG_NOTIF_WRONG_CAPTCHA."</div>";
}
?>
<?php
$codesms = substr(str_shuffle(str_repeat("121234567890123434567890567890011223344556677889900558877443365982541", 64)), 0, 7);
?>
</div>
	<div class="row">
                        
                        	<div class="col-md-9">
                            	<div class="content-box">
                                    <h3 class="content-box-header bg-primary">
                                        <i class="glyph-icon icon-file-zip-o"></i>
                                       Change Password
                                    </h3>
                                        <div class="content-box-wrapper">
                                            <form id="tab" action="" method="post">
                                            
											 <input type="hidden" id="kodex" name="kodex" value="<?php echo $codesms; ?>"/>
                     <input name="hp" id="hp" type="hidden" value="<?php echo $db->dataku("hp", $user_session); ?>" size="40"/> 

     

      
      <div class="controls-row">

            <div class="col-md-12"> <label>New Password</label></div>

       		

         </div>

         

         <div class="controls-row">

            <div class="col-md-12"> <input name="password1" type="password" class="form-control" id="password1" value="" ></div>

       		

         </div>
         
         
         
         <div class="controls-row">

            <div class="col-md-12"> <label>Confirm New Password</label></div>

       		

         </div>

         

         <div class="controls-row">

            <div class="col-md-12"> <input name="password2" type="password" class="form-control" id="password2" value=""></div>

       		

         </div>
         
      

      <div class="controls-row">

            <div class="col-md-6"> <label>Old Password</label></div>

       		<div class="col-md-6"><label>&nbsp;</label></div>

      </div>

      

      <div class="controls-row">

            <div class="col-md-6"> <input name="passwordx" type="password" class="form-control" id="passwordx"></div>

       	
      </div>

       

        <div style="margin:10px;">

              <input type="submit" value="Update"class="btn btn-primary" name="changepass">

          </div>

        </form>
                                        </div>
                                	</div>
                            </div>
                            <div class="col-md-3">
                                
                                    
                            
                               
                                   
                                	</div>
                        		
                            
                            </div>
                            
                            </div>
                        
                        
                        </div>
<?php } } ?>
<?php ob_flush(); ?>