<?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($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>
<!--[if IE 8]>
<html lang="en" class="ie8"> <![endif]-->
<!--[if !IE]><!-->
<html lang="en">
<!--<![endif]-->
<head>
    <meta charset="utf-8"/>
    <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>Forgot Password - <?php echo WEB_TITLE; ?></title>
    <link href="images/banner/<?php echo WEB_FAVCONS; ?>" rel="SHORTCUT ICON" /><!--favicon-->
    <meta content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" name="viewport"/>

    <!-- ================== BEGIN BASE CSS STYLE ================== -->
    <link href="themes/assets/plugins/jquery-ui/themes/base/minified/jquery-ui.min.css" rel="stylesheet"/>
    <link href="themes/assets/plugins/bootstrap/css/bootstrap.min.css" rel="stylesheet"/>
    <link href="themes/assets/plugins/font-awesome/css/font-awesome.min.css" rel="stylesheet"/>
    <link href="themes/assets/css/animate.min.css" rel="stylesheet"/>
    <link href="themes/assets/css/style.min.css" rel="stylesheet"/>
    <link href="themes/assets/css/style-responsive.min.css" rel="stylesheet"/>
    <link href="themes/assets/css/theme/default.css" rel="stylesheet" id="theme"/>
    <!-- ================== END BASE CSS STYLE ================== -->

    <!-- ================== BEGIN BASE JS ================== -->
    <script src="themes/assets/plugins/pace/pace.min.js"></script>
	<script src='https://www.google.com/recaptcha/api.js'></script>
    <!-- ================== END BASE JS ================== -->
</head>
<body class="pace-top bg-white">
<!-- begin #page-loader -->
<div id="page-loader" class="fade in"><span class="spinner"></span></div>
<!-- end #page-loader -->

<!-- begin #page-container -->
<div id="page-container" class="">
    <!-- begin login -->
    <div class="login login-with-news-feed">
        <!-- begin news-feed -->
        <div class="news-feed">
            <div class="news-image">
                <img src="themes/assets/img/login-bg/bg-15.jpg" alt="">
            </div>
            
        </div>
        <!-- end news-feed -->
        <!-- begin right-content -->
        <div class="right-content">
            <!-- begin login-header -->
            <div class="login-header">
                <center>
                  <img src="themes/img/coin.png" style="width:200px;">
                    <div class="brand">&nbsp;
                    </div>
                </center>
            </div>
            <!-- end login-header -->
            <!-- begin login-content -->
            <div class="login-content">
            
        
 <?php
if (isset($_GET['do']) && $_GET['do'] == "send") {
	
if(isset($_GET["sess"])){ $sess = anti_injection($_GET["sess"]); }
if(isset($_GET["token"])){ $token = anti_injection($_GET["token"]); }


$cek=md5(md5(date('\i\t \i\s \t\h\e jS \d\a\y g a')).md5($sess));
if(!$sess || !$token || $token<>$cek){
header("location: ./forgotpass.php?result=no_session");
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 (!$recaptcha['success']) { 
         header("location: forgotpass.php?result=wrong_captcha");
      } else {

		
		  
  $userid = anti_injection($_POST['username']);
	  
	  $db->select("username", "member", "username='".mysql_real_escape_string($userid)."'");
   
   
    if($db->num_rows() == 0){ 
		
      header("location:./forgotpass.php?result=wrong_user");
       // exit(); 
    } else {
    // Everything looks ok, generate password, update it and send it!
	$username = $db->result(0, "username");
	$nama = $db->dataku("nama",$username);
	
 $email = anti_injection($_POST['email']);
		 
		 
$sqlc = mysql_query("SELECT * FROM member WHERE username='$userid' and email='$email'");
$numc = mysql_num_rows($sqlc);
if(!$numc) {
	header("location: ./forgotpass.php?result=wrong_mail");
	exit;
} else {

	
    //$sql = "UPDATE member SET pass='$db_password' WHERE username='$username'";
	//myquery($sql);
	$admin_email = $db->config("email");
	$clientdate    = (date ("Y-m-d H:i:s"));
	$tgl = formatgl($clientdate);
	$waktu = date("H:i:s");
	$time=time();
	$sess = substr(str_shuffle(str_repeat("ABCDEFGH45678IJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmno8367450162pqrstuvwxyz", 64)), 0, 64);
	$token = md5(md5($clientdate));
	$links = $changepass."?sess=".$sess."&token=".$token;
	
	$sql = mysql_query("SELECT * FROM changepass WHERE username='".mysql_real_escape_string($username)."'");
$num = mysql_num_rows($sql);
$rw=mysql_fetch_array($sql);
$batas = $rw['batas'];
if($batas == 3) {

header("location: ./forgotpass.php?result=already_sent&m=3");
	exit;


?>
<?php
}else{
if($num!= "") {
		$db->update("changepass", "date='$time', sess='$sess', token='$token', batas = batas + 1", "username='".mysql_real_escape_string($username)."'");	
		
	
	

$mail = new PHPMailer(); // defaults to using php "mail()"
$data = $mail_konfirmasi_reset_password_isi;
	$data = preg_replace("/{links}/", $links, $data);			
    $data = preg_replace("/{username}/", $username, $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_konfirmasi_reset_password_subject;
	$datax = preg_replace("/{nama}/", $nama, $datax);	
	$subject_konfirmasi_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_konfirmasi_reset_password."";
	$mail->AltBody    = "Pesan HTML, Untuk melihat pesan, silakan menggunakan peninjau HTML email yang kompatibel!"; // Alt Body
	$mail->MsgHTML($body);

$mail->Send();

$ussx=base64_encode($email); 
header("location: ./forgotpass.php?result=refresh&m=$ussx");
	exit;

?>
<?php	
 
    }else{
	$db->insert("changepass", "", "'', '".mysql_real_escape_string($username)."', '$sess', '$time', '', '$token', '0'");
	
	$clientdate    = (date ("Y-m-d H:i:s"));
	$tgl = formatgl($clientdate);
		$waktu = date("H:i:s");
		
$mail = new PHPMailer(); // defaults to using php "mail()"
$data = $mail_konfirmasi_reset_password_isi;
	$data = preg_replace("/{links}/", $links, $data);			
    $data = preg_replace("/{username}/", $username, $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_konfirmasi_reset_password_subject;
	$datax = preg_replace("/{nama}/", $nama, $datax);	
	$subject_konfirmasi_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_konfirmasi_reset_password."";
	$mail->AltBody    = "Pesan HTML, Untuk melihat pesan, silakan menggunakan peninjau HTML email yang kompatibel!"; // Alt Body
	$mail->MsgHTML($body);

$mail->Send();

$ussx=base64_encode($email); 
header("location: ./forgotpass.php?result=success&m=$ussx");
	exit;
	
}
}
}
}
}
}
}else{
?>
                    
                    
     <?php
if(isset($_GET['result'])&&$_GET['result']=="no_session"){
echo "<div class='alert alert-danger'>Session Not Found!<br>Please update passwords through a link that we sent to your email.</div>";
}
?>
		<?php
if(isset($_GET['result'])&&$_GET['result']=="wrong_captcha"){
echo "<div class='alert alert-danger'>Wrong Captcha!</div>";
}
?>	  
	<?php
if(isset($_GET['result'])&&$_GET['result']=="wrong_user"){
echo "<div class='alert alert-danger'>User Not Found!</div>";
}
?>	  
  
	<?php
if(isset($_GET['result'])&&$_GET['result']=="wrong_mail"){
echo "<div class='alert alert-danger'>Wrong Email!</div>";
}
?>	

<?php
if(isset($_GET['result'])&&$_GET['result']=="already_sent"){
$m = $_GET['m'];
echo "<div class='alert alert-danger'>You have sent a password reset as ".$m." times, please proccess your reset password first before being able to send a password reset back.</div>";
}
?>

<?php
if(isset($_GET['result'])&&$_GET['result']=="success"){
$m = $_GET['m'];
$m2=base64_decode($m);
echo "<div class='alert alert-success'>Reset password has been sent to ".$m2.", please check your mailbox.</div>";
}
?>	
<?php
if(isset($_GET['result'])&&$_GET['result']=="refresh"){
$m = $_GET['m'];
$m2=base64_decode($m);
echo "<div class='alert alert-success'>reset password has been sent previously, please check your mailbox ".$m2.".</div>";
}
?>	               
                    
                    
     <?php
$sess = substr(str_shuffle(str_repeat("ABCaqDEFG345678HIJKLMNOPQ345678RSTUVWXYZ0123456789abcdefghijklmnop32q34STUVW5678rstuvwxyz", 96)), 0, 96);
$token = md5(md5(date('\i\t \i\s \t\h\e jS \d\a\y g a')).md5($sess));
?>                 
            
            
            
            
            
            
            
            
            
            
                <form method="POST" action="forgotpass.php?do=send&sess=<?php echo $sess;?>&token=<?php echo $token;?>" accept-charset="UTF-8" class="margin-bottom-0">
                                <div class="form-group m-b-15">
                    <input class="form-control input-lg" placeholder="Username" required name="username" type="text">
                </div>
                <div class="form-group m-b-15">
                    <input class="form-control input-lg" placeholder="Email Address" required name="email" type="text" value="">
                </div>
                <div class="form-group m-b-15">
                    <div class="g-recaptcha" data-sitekey="<?php echo $site_key_google; ?>"></div>
                </div>
                <div class="login-buttons">
                    <button type="submit" class="btn btn-primary btn-block btn-lg">Send Password</button>
                </div>
                <div class="m-t-20 m-b-40 p-b-40 text-inverse">
                    Login Member Click <a href="login.php" class="text-success">Here</a><br><?php if ($regpublic == 1){ ?>Not a member yet? Click <a href="signup.php" class="text-success">Here</a> to register.<br><?php } ?>
                    
                </div>
                <!--<div align="center" style="margin-top:-30px;">
               <a href="#" onclick="window.open('https://www.sitelock.com/verify.php?site=vpchain.co','SiteLock','width=600,height=600,left=160,top=170');" ><img class="img-responsive" alt="SiteLock" title="SiteLock" src="//shield.sitelock.com/shield/vpchain.co" /></a>
                </div>-->
                <hr/>
                <p class="text-center">
                  Copyright &copy;  <?php echo WEB_FOOTER; ?>
                </p>
                </form>
                <?php } ?>
            </div>
            <!-- end login-content -->
        </div>
        <!-- end right-container -->
    </div>
    <!-- end login -->
</div>
<!-- end page container -->

<!-- ================== BEGIN BASE JS ================== -->
<script src="themes/assets/plugins/jquery/jquery-1.9.1.min.js"></script>
<script src="themes/assets/plugins/jquery/jquery-migrate-1.1.0.min.js"></script>
<script src="themes/assets/plugins/jquery-ui/ui/minified/jquery-ui.min.js"></script>
<script src="themes/assets/plugins/bootstrap/js/bootstrap.min.js"></script>
<!--[if lt IE 9]>
<script src="/assets/crossbrowserjs/html5shiv.js"></script>
<script src="/assets/crossbrowserjs/respond.min.js"></script>
<script src="/assets/crossbrowserjs/excanvas.min.js"></script>
<![endif]-->
<script src="themes/assets/plugins/slimscroll/jquery.slimscroll.min.js"></script>
<script src="themes/assets/plugins/jquery-cookie/jquery.cookie.js"></script>
<!-- ================== END BASE JS ================== -->

<!-- ================== BEGIN PAGE LEVEL JS ================== -->
<script src="themes/assets/js/apps.min.js"></script>
<!-- ================== END PAGE LEVEL JS ================== -->

<script>
  $(document).ready(function () {
    App.init()
  })
</script>
<?php if($stchat == 1) { echo $lchats; }?>
</body>
</html>
<?php ob_flush(); ?>