<?php ob_start(); 
error_reporting(0);
(@include ('./dt_page/common.php')) or die("<p style='font-family:Arial, Helvetica, sans-serif; margin-top:80px; font-size:16px; line-height:180%; letter-spacing:2px;' align='center'><img src='https://primadesain.com/images/block.png' width='90' height='90' /></br></br>Database failed, you can not access this script.<br>Please contact us to fix this error.<br><strong><a href='http://www.primadesain.com'>www.primadesain.com</a></strong></p><br><p style='font-family:Arial, Helvetica, sans-serif; margin-top:30px; font-size:12px; line-height:180%; letter-spacing:2px;' align='center'>&copy; 2009 - ".date("Y")." www.primadesain.com</p>");
(@include ('./dt_page/classMySQL.php')) or die("<p style='font-family:Arial, Helvetica, sans-serif; margin-top:80px; font-size:16px; line-height:180%; letter-spacing:2px;' align='center'><img src='https://primadesain.com/images/block.png' width='90' height='90' /></br></br>System failed, you can not access this script.<br>Please contact us to fix this error.<br><strong><a href='http://www.primadesain.com'>www.primadesain.com</a></strong></p><br><p style='font-family:Arial, Helvetica, sans-serif; margin-top:30px; font-size:12px; line-height:180%; letter-spacing:2px;' align='center'>&copy; 2009 - ".date("Y")." www.primadesain.com</p>");
$db = new db_mysql($server_name, $userdb, $passdb, $databasename,"");
(@include ('./dt_page/function.php')) or die("<p style='font-family:Arial, Helvetica, sans-serif; margin-top:80px; font-size:16px; line-height:180%; letter-spacing:2px;' align='center'><img src='https://primadesain.com/images/block.png' width='90' height='90' /></br></br>Function failed, you can not access this script.<br>Please contact us to fix this error.<br><strong><a href='http://www.primadesain.com'>www.primadesain.com</a></strong></p><br><p style='font-family:Arial, Helvetica, sans-serif; margin-top:30px; font-size:12px; line-height:180%; letter-spacing:2px;' align='center'>&copy; 2009 - ".date("Y")." www.primadesain.com</p>");
(@include ('./dt_page/affiliate.php')) or die("<p style='font-family:Arial, Helvetica, sans-serif; margin-top:80px; font-size:16px; line-height:180%; letter-spacing:2px;' align='center'><img src='https://primadesain.com/images/block.png' width='90' height='90' /></br></br>Refferal system failed, you can not access this script.<br>Please contact us to fix this error.<br><strong><a href='http://www.primadesain.com'>www.primadesain.com</a></strong></p><br><p style='font-family:Arial, Helvetica, sans-serif; margin-top:30px; font-size:12px; line-height:180%; letter-spacing:2px;' align='center'>&copy; 2009 - ".date("Y")." www.primadesain.com</p>");
if($db->config("maintenance") == 1){ ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<!--
	/* 
	#######################
	http://primadesain.com
	primapc57@gmail.com
    +62 8122222044
	#######################
	*/
-->
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title><?php echo $db->config("title"); ?></title>
<link href="images/banner/<?php echo $db->config("fcon"); ?>" rel="SHORTCUT ICON" />
<link href="https://fonts.googleapis.com/css?family=Raleway:100,600" rel="stylesheet" type="text/css">
<style>
 html, body {
                background-color: #fff;
                color: #636b6f;
                font-family: 'Raleway', sans-serif;
                font-weight: 100;
                margin: 0;
            }

            .flex-center {
                align-items: center;
                display: flex;
                justify-content: center;
            }
            .content {
                text-align: center;
				margin-top:50px;
            }

			.linetext {
                font-size: 20px;
                padding: 20px;
				max-width:600px;
				font-weight:bold;
				line-height:160%;
            }
			</style>
</head>
<body>
<div class="flex-center">
<div class="content">
<img src="images/maintenance.png" style="max-width:600px; width:100%;">
<div class="linetext"><?php echo $db->config("maintenance_info"); ?></div>
</div>
</div>
</body>
</html>
<?php } else { 
if($lang == 1){
include("./dt_page/langid.php");
}else{
include("./dt_page/langen.php");
}
require_once('./dt_page/class.phpmailer.php');
include("./dt_page/class.smtp.php");

if ($blockie == 1 && preg_match("/MSIE/",getenv("HTTP_USER_AGENT")) ||
preg_match("/Internet Explorer/",getenv("HTTP_USER_AGENT"))) {
include ('./block_ie.php');
exit;
}   
?>
<!doctype html>
<html class="no-js" lang="">

<head>
<!--
	/* 
	#######################
	http://primadesain.com
	primapc57@gmail.com
    +62 8122222044
	#######################
	*/
-->
    <meta charset="utf-8">
    <meta http-equiv="x-ua-compatible" content="ie=edge">
      <meta name="author" content="<?php echo WEB_DOMAIN; ?>"/>
    <meta name="description" content="<?php echo WEB_DESC; ?>" />
    <meta name="keywords" content="<?php echo WEB_KEYWORDS; ?>" />
	<title>Update Password - <?php echo WEB_TITLE; ?></title>
    <link href="images/banner/<?php echo WEB_FAVCONS; ?>" rel="SHORTCUT ICON" /><!--favicon-->
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <!-- Favicon -->
    <!-- Bootstrap CSS -->
    <link rel="stylesheet" href="logintheme/css/bootstrap.min.css">
    <!-- Fontawesome CSS -->
    <link rel="stylesheet" href="logintheme/css/fontawesome-all.min.css">
    <!-- Flaticon CSS -->
    <link rel="stylesheet" href="logintheme/font/flaticon.css">
    <!-- Google Web Fonts -->
    <link href="https://fonts.googleapis.com/css?family=Roboto:300,400,500,700&display=swap" rel="stylesheet">
    <!-- Custom CSS -->
    <link rel="stylesheet" href="logintheme/style.css">
	<script src='https://www.google.com/recaptcha/api.js'></script>
  <script src="js/sweetalert-dev.js"></script>
  <link rel="stylesheet" href="css/sweetalert.css">  
</head>

<body>
    <!--[if lt IE 8]>
        <p class="browserupgrade">You are using an <strong>outdated</strong> browser. Please <a href="http://browsehappy.com/">upgrade your browser</a> to improve your experience.</p>
    <![endif]-->     
    <section class="fxt-template-animation fxt-template-layout28" data-bg-image="logintheme/img/figure/bg28-l.jpg">  
        <!-- Animation Start Here -->
        <div id="particles-js"></div>
        <!-- Animation End Here -->     
        <div class="fxt-content">
            <div class="fxt-header" style="margin-top:-30px;">
                <a href="index.php" class="fxt-logo" style="margin-bottom:25px;"><img src="logintheme/img/logo-28.png" alt="Logo" style="width:<?php echo $withlogone; ?>px;"></a> 
               
            </div>                            
            <div class="fxt-form"> 
                <div class="fxt-transformY-50 fxt-transition-delay-1">
                    <p>Update Your Password</p>
                    
                            <?php
if(isset($_GET['result'])&&$_GET['result']=="wrong_captcha"){
echo '<script type=text/javascript>
              swal({
  title: "Wrong Captcha",
  type: "error",
  showCancelButton: false,
  confirmButtonColor: "#DD6B55",
  confirmButtonText: "OK",
  cancelButtonText: "No, cancel plx!",
  closeOnConfirm: true,
  closeOnCancel: false
});
              </script>';	
}
?>
<?php
$results = $_GET['result'];
if($results == "wrong_code") { 
echo '<script type=text/javascript>
              swal({
  title: "Wrong Validation Code",
  type: "error",
  showCancelButton: false,
  confirmButtonColor: "#DD6B55",
  confirmButtonText: "OK",
  cancelButtonText: "No, cancel plx!",
  closeOnConfirm: true,
  closeOnCancel: false
});
              </script>';	
}
?>
<?php
$results = $_GET['result'];
if($results == "wrong_pass") { 
echo '<script type=text/javascript>
              swal({
  title: "Error Password!",
  text: "Both passwords must be the same and should not be empty.",
  type: "error",
  showCancelButton: false,
  confirmButtonColor: "#DD6B55",
  confirmButtonText: "OK",
  cancelButtonText: "No, cancel plx!",
  closeOnConfirm: true,
  closeOnCancel: false
});
              </script>';	
}
?>
<?php
$results = $_GET['result'];
if($results == "wrong_session") { 
echo '<script type=text/javascript>
              swal({
  title: "Error Session!",
  text: "Session Not Found! Please update passwords through a link that we sent to your email.",
  type: "error",
  showCancelButton: false,
  confirmButtonColor: "#DD6B55",
  confirmButtonText: "OK",
  cancelButtonText: "No, cancel plx!",
  closeOnConfirm: true,
  closeOnCancel: false
});
              </script>';	
$disse4="disabled";
}
?>        
                </div>
                
                
                                 <?php
if (isset($_GET['do']) && $_GET['do'] == "send") {
if(isset($_GET["sess"])){ $sesine = anti_injection($_GET["sess"]); }
if(isset($_GET["token"])){ $token = anti_injection($_GET["token"]); }


	 $ssn = $_POST['sessi'];
	$tkn= $_POST['token'];
    $user= $_POST['user'];
	$pass1 = $_POST["password"];
	$pass2 = $_POST["password2"];
	

if(empty($sesine) || empty($token)){
header("location: resetpass.php?result=wrong_session&sess=$sesine&token=$token");
	exit;
} else {
	
	
$captcha = isset($_POST['g-recaptcha-response']) ? $_POST['g-recaptcha-response']:'';
$secret_key = $secret_key_google; //masukkan secret key-nya berdasarkan secret key masig-masing saat create api key nya
$url = 'https://www.google.com/recaptcha/api/siteverify?secret=' . urlencode($secret_key) . '&response=' . $captcha;   
   $recaptcha = file_get_contents($url);
   $recaptcha = json_decode($recaptcha, true);
   if ($usecaptcha==1 && !$recaptcha['success']) { 
         header("location: forgotpass.php?result=wrong_captcha");
      } else {
		
	
$sql2 = mysql_query("SELECT * FROM changepass WHERE sess='".mysql_real_escape_string($sesine)."' AND token='".mysql_real_escape_string($token)."' AND username='".mysql_real_escape_string($user)."'");
$num2 = mysql_num_rows($sql2);
$rw2=mysql_fetch_array($sql2);
$users2 = $rw2['username'];
$ssions2 = $rw2['sess'];
$tokens2 = $rw2['token'];
if(empty($num2) || $ssn <> $ssions2 || $tkn <> $tokens2) {

header("location: resetpass.php?result=wrong_session&sess=$sesine&token=$token");
	exit;
}else{
	if(empty($pass1) || empty($pass2)){	
		header("location:./resetpass.php?sess=".$sesine."&token=".$token."&result=wrong_pass");
		
		}else{
		if($pass1 <> $pass2){
				header("location:./resetpass.php?sess=".$sesine."&token=".$token."&result=wrong_pass");
		
		} else {
			$pswd=md5($pass1);
				$db->update("member", "pass='$pswd'", "username='$users2'");
			$db->update("acc", "pass='$pass1'", "username='$users2'");
				

$nama = $db->dataku("nama", $users2);
		$email = $db->dataku("email", $users2);
		$tgl = formatgl($clientdate);
		$waktu = date("H:i:s");
		$firstname = $db->dataku("nama", $users2);
		$hp = $db->dataku("hp", $users2);

$stkode = strtotime(date("Y-m-d H:i:s"));	
if($sms_request_status == 1){
$datasms3 = $sms_request_isi;
	$datasms3 = preg_replace("/{firstname}/", $firstname, $datasms3);	
	$datasms3 = preg_replace("/{user}/", $users2, $datasms3);					
    $datasms3 = preg_replace("/{pass}/", $pass1, $datasms3);	
	$isipesan = $datasms3;
	mysql_query("insert into outbox values('', '$stkode', '".mysql_real_escape_string($username)."', '$hp', '$isipesan', '$clientdate', '1')") or die(mysql_error());
	sendsms($hp, $isipesan) ;
	}
if($hp){
$isipesane = "Hello ".$nama.", your new password in ".$bisnisname." is ".$pass1."";
sendwa($hp, $isipesane, $apikeywoowa);	
}	

$mail = new PHPMailer(); // defaults to using php "mail()"
$data = $mail_reset_password_isi;
	$data = preg_replace("/{users2}/", $users2, $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;


//$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();

$db->delete("changepass", "username='$users2'");
 header("location: login.php?result=success_psw&u=$users2&p=$pass1");
  exit;

}
}
}
}
}
?>
<?php
}else{
?>
    <?
if(isset($_GET["sess"])){ $sesine = anti_injection($_GET["sess"]); }
if(isset($_GET["token"])){ $token = anti_injection($_GET["token"]); }

$sql = mysql_query("SELECT * FROM changepass WHERE sess='".mysql_real_escape_string($sesine)."' AND token='".mysql_real_escape_string($token)."'");
$num = mysql_num_rows($sql);
$rw=mysql_fetch_array($sql);
$users = $rw['username'];
$ssions = $rw['sess'];
$tokens = $rw['token'];
$waktune = $rw['date'];
$time=time();
$times=$time-86400; 

?>    	
	
			
	
	<?php
if(isset($_GET["sess"])){ $sesine = anti_injection($_GET["sess"]); }
if(isset($_GET["token"])){ $token = anti_injection($_GET["token"]); }
if(empty($sesine) || empty($token)){ 

echo "<div class='alert alert-danger'>Session Not Found! Please update passwords through a link that we sent to your email.</div>";
$disse="disabled";
} 

if($waktune && $waktune < $times) {
$db->delete("changepass", "sess='".mysql_real_escape_string($sesine)."' and token='".mysql_real_escape_string($token)."'");	

echo "<div class='alert alert-danger'>Session Expired! Please do reset password again.</div>";	  
	  $disse2="disabled";
}

?>


                
                <form action="resetpass.php?do=send&sess=<?php echo $sesine;?>&token=<?php echo $token;?>" method="POST">
                <input name="user" id="user" type="hidden" size="19" value="<?php echo $users; ?>">
        <input name="sessi" type="hidden" size="19" value="<?php echo $ssions; ?>">
	<input name="token" type="hidden" size="19" value="<?php echo $tokens; ?>">
                
                    <div class="form-group"> 
                        <div class="fxt-transformY-50 fxt-transition-delay-2">   
                   <input class="form-control" placeholder="Type your new password" required name="password" type="password" <?php echo $disse;?> <?php echo $disse2;?> <?php echo $disse3;?> <?php echo $disse4;?>>                 
                        </div>
                    </div>
                    <div class="form-group">  
                        <div class="fxt-transformY-50 fxt-transition-delay-3">   
                  <input class="form-control" placeholder="Retype your new password" required name="password2" type="password" <?php echo $disse;?> <?php echo $disse2;?> <?php echo $disse3;?> <?php echo $disse4;?>>  
                        </div>
                    </div>
                    
                <?php if($usecaptcha==1){ ?>
                    <div class="form-group">  
                        <div class="fxt-transformY-50 fxt-transition-delay-3">    
						<div class="g-recaptcha" data-sitekey="<?php echo $site_key_google; ?>"></div>
                        </div>
                    </div>
                <?php } ?>
                    
                    
                    <div class="form-group">
                        <div class="fxt-transformY-50 fxt-transition-delay-4">
                            <div class="fxt-checkbox-area">
                               
                               
                                
                                <div id="showme" style="display:none;"></div>
  <div id="loadingGif" style="display:none">
                                <img src="images/ld.gif" style="width:100px;"></div>
                                <button type="submit" class="fxt-btn-fill" <?php echo $disse;?> <?php echo $disse2;?> <?php echo $disse3;?> <?php echo $disse4;?> id="Login" onclick="showDiv()">Update Password</button> 
                                
                            </div>
                                
                                
                                
                            </div>
                        </div>
                    </div>
                </form>   
                 <script type='text/javascript'>
   function showDiv() {
  document.getElementById('Login').style.display = "none";
  document.getElementById('loadingGif').style.display = "block";
  setTimeout(function() {
    document.getElementById('loadingGif').style.display = "none";
    document.getElementById('showme').style.display = "block";
  },2000);
   
}
</script>        
                <?php } ?>            
            </div> 
           
          
        </div>
    </section>    
    <!-- jquery-->
    <script src="logintheme/js/jquery-3.5.0.min.js"></script>
    <!-- Popper js -->
    <script src="logintheme/js/popper.min.js"></script>
    <!-- Bootstrap js -->
    <script src="logintheme/js/bootstrap.min.js"></script>
    <!-- Imagesloaded js -->
    <script src="logintheme/js/imagesloaded.pkgd.min.js"></script>
    <!-- Particles js -->
    <script src="logintheme/js/particles.js"></script>
    <script src="logintheme/js/particles-1.js"></script>
    <!-- Validator js -->
    <script src="logintheme/js/validator.min.js"></script>
    <!-- Custom Js -->
    <script src="logintheme/js/main.js"></script>


<script>
var width = $('.g-recaptcha').parent().width();
if (width < 302) {
	var scale = width / 302;
	$('.g-recaptcha').css('transform', 'scale(' + scale + ')');
	$('.g-recaptcha').css('-webkit-transform', 'scale(' + scale + ')');
	$('.g-recaptcha').css('transform-origin', '0 0');
	$('.g-recaptcha').css('-webkit-transform-origin', '0 0');
}
</script><?php if($stchat == 1) { include("tawkto.php"); 
} else if($stchat == 2) { include("whatshelp.php"); 
} else if($stchat == 3) { include("whatshelptawk.php"); 
} ?> 
</body>
</html>
<?php } ?>