<?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();} 
?>
<?php
	/* 
	############################[  <about> ] #######################
		S Name   ::       Inv-X Primadesain
		Update   ::       2013 © Primadesain.Com
		Author   ::       Agus Susanto S.kom
		Website  ::		  http://primadesain.com
		Contact  ::		  <primapc57@gmail.com> // +62 85228657360
	
	Primadesain melayani pembuatan website MLM dan Investasi
	( dengan sistem binary, trinary atau matrix dan matahari )
	juga menerima pembuatan website Iklan Baris, Website Profile,
	Reseller, Hyip, dll.
	############################[ </about> ] #######################
	*/
?>
<style>
.alerts				{ margin:3px; padding:5px 10px 5px 35px; display:block; line-height:20px; font-family:Tahoma; background:#f5f5f5;
					  border:1px solid; text-shadow:none; box-shadow:0 0 0 1px rgba(255,255,255,0.1); -webkit-transition: all 100ms linear; 
					  -moz-transition: all 100ms linear; -o-transition: all 100ms linear; -ms-transition: all 100ms linear; 
					  transition: all 100ms linear; font-weight:normal; font-size:16px; }
	.success		{ color:#00632e; border-color:#339933; background:#d1e8d2 url(../img/frontend/tick_circle.png) no-repeat 10px 7px; }
	.error			{ color:#820101; border-color:#dc1c1c; background:#facfcf url(../img/frontend/cross_circle.png) no-repeat 10px 7px; }
	.warning		{ color:#675100; border-color:#d4b64b; background:#fdefbd url(../img/frontend/exclamation.png) no-repeat 10px 7px; }
	.info			{ color:#00357b; border-color:#9dbfea; background:#d8e7fa url(../img/frontend/information.png) no-repeat 10px 7px; }
	.note			{ color:#4d4d4d; border-color:#bdbdbd; background:#f4f4f4 url(../img/frontend/notebook.png) no-repeat 10px 7px; }
.alert:hover		{ opacity:0.8; }
.notification		{ cursor:pointer; }
</style>
<link rel="stylesheet" href="../css/layout.css" type="text/css" media="screen" />
<sectiony id="main" class="column">
<?php
if($db->dataku("status", $user_session) == 0 || $db->dataku("blokir", $user_session) == 1) {
echo "<br /><div class='alerts error notification' style='margin-left:13px; width:400px; font-size:12px;'></span>Keanggotaan anda tidak aktif atau sedang di blokir!</div>";
echo "<div align='center'><a href='javascript:history.go(-1)'><button class='primaback'>Back</button></a><br /></div>";
}else{
?>
<?php
if (isset($_GET['do']) && $_GET['do'] == "check") {
$kodex = substr(str_shuffle(str_repeat("121234567890123434567890567890011223344556677889900558877443365982541", 64)), 0, 5);
$pine = md5($_POST['pincode']);	
$fields = $_POST['fields'];	
$sendto = $_POST['sendto'];	

$nama = $db->dataku("nama", $user_session);
$email = $db->dataku("email", $user_session);
$hp = $db->dataku("hp", $user_session);

if($fields == 1){
	$jnse = "Payment Account";
}else if($fields == 2){
	$jnse = "Phone Number";
}else if($fields == 3){
	$jnse = "Email Account";
}else {
	$jnse = "All Field";
}

if($sendto == 0){
$tjnex = "email address";	
}else{
$tjnex = "mobile number";	
}
$expired = date('Y-m-d H:i:s', strtotime("+1 hours"));
$sqlocc = mysql_query("SELECT * FROM unlockfield WHERE username='$user_session'");
$numocc = mysql_num_rows($sqlocc);
if($numocc > 0) {
	
	header("location: ?go=unlock&result=wait&t=".base64_encode($tjnex)."");
	
	exit;
	
	
}else{
	mysql_query("insert into unlockfield values('','$user_session', '$fields', '$kodex', '$expired')");


if($sendto == 0 && $email){
$tjne = "Email Address ".$email;	
$isimail="<a href='http://".$domain."'><img src='".$logoinvoice."' style='display:inline;outline-style:none;text-decoration:none;' /></a><br><br><br>
<p>Hello ".$nama." (".$user_session."),</p>
<p>Enter verification code below to reset the field.</p>
<p><strong>Code: ".$kodex."</strong><br>
Field Reset: ".$jnse."<br>
</p>
<p><br><br><br>
Regards,<br>
<b>".$bisnisname."</b><br>
".$domain."<br>".$emailadmin."<br>".$hpadmin."</p>";
	   
	    $mail3b = new PHPMailer;
		if($smaile == 1){	
//$mail3b->IsSMTP(); // telling the class to use SMTP
$mail3b->Host       = $smtphost; // SMTP server
$mail3b->SMTPAuth   = true;                  // enable SMTP authentication
$mail3b->Host       = $smtphost; // sets the SMTP server
$mail3b->Port       = $smtport;                    // set the SMTP port for the GMAIL server
$mail3b->Username   = $smtpuser; // SMTP account username
$mail3b->Password   = $smtpass;        // SMTP account password
}
        $mail3b->setFrom($emailadmin, $bisnisname);
        $mail3b->addAddress($email, $nama);
	    $mail3b->IsHTML(true);       
        $mail3b->Subject = ''.$nama.', verification code reset field';
        $mail3b->msgHTML($isimail);
    $mail3b->send();	
	
	
}else if($sendto == 1 && $hp){
$tjne = "Mobile Number ".$hp;	
	
$isipesan = "Hello ".$nama.", To reset field: ".$jnse.", enter this verification code: ".$kodex."";

	mysql_query("insert into outbox values('', '', '$user_session', '$hp', '$isipesan', '$clientdate', '1')");
	if($smsgtw == 1 && $jsms == 1){
	$hpne = preg_replace('/\D+/', '', $hp);
	$sms = new smsreguler();
	$sms->username = $userkey;
		$sms->password = $passkey;
		$sms->apikey   = $apikey;
		$sms->setTo($hpne);
		$sms->setText($isipesan);
		$sms->smssend();
	}else if($smsgtw == 1 && $jsms == 2){
	$hpne = preg_replace('/\D+/', '', $hp);
	$sms = new smsmasking();
	$sms->username = $userkey;
		$sms->password = $passkey;
		$sms->apikey   = $apikey;
		$sms->setTo($hpne);
		$sms->setText($isipesan);
		$sms->smssend();
	}else if($smsgtw == 2){
	sendsms($hp, $isipesan) ;
	}else{}	
}
	
echo "<br /><div class='alerts success notification' style='margin-left:13px; width:400px; font-size:12px;'><span>Verification code has been sent to your ".$tjne."</span></div>";

?>

<article class="module width_full" style="width:450px">
			<header>
			  <h3><img src="../images/bullet_black.png" />&nbsp;&nbsp;<?php echo $LANG["unlockfield"]; ?></h3>
			</header>
			
				<div class="module_content" style="width:410px;overflow:visible;">
						<form name="frcheck" id="frcheck" method="post" action="?go=unlock&do=submit" />
						<fieldset>
							<label>Verification Code :</label>
							 <input name="kode" id="kode" type="text" style="width:280px;"  onMouseover="ddrivetip('enter  verification code sent to your <?php echo $tjne; ?>')"; onMouseout="hideddrivetip()"  required='required'/>
							   <input type="hidden" id="fields" name="fields" value="<?php echo $fields; ?>"/>
							
						</fieldset>
						<div class="clear"></div>
				</div>
				<footer>
			
				<div class="submit_link">
				<button class='primapcm' name='submit' type='submit' onClick='storeSomething()'>Unlock</button>&nbsp;&nbsp;<a href="#" onclick="window.close()"><button class='primapc2m' type='reset'><?php echo $LANG["cancel"]; ?></button></a>
				</div>
				
			</footer>
				</form>
  
	  </article><!-- end of post new article -->
<?php
}
?>

<?php
}else if (isset($_GET['do']) && $_GET['do'] == "submit") {
$kode = anti_injection($_POST['kode']);
$kodex = anti_injection($_POST['kodex']);
$fields = anti_injection($_POST['fields']);

$sqlobb = mysql_query("SELECT * FROM unlockfield WHERE username='$user_session' and kode='$kode'");
$numobb = mysql_num_rows($sqlobb);
if(!$numobb) {
$db->delete("unlockfield", "username='$user_session'");
header("location: ?go=unlock&result=wrong_code");
	
	exit;

}else{

if($fields == 1){
	$fdne = "Field Payment Account";
mysql_query("UPDATE member SET bank='' WHERE username='$user_session'");
} else if($fields == 2){
	$fdne = "Field Phone Number";
mysql_query("UPDATE member SET hp='' WHERE username='$user_session'");
} else if($fields == 3){
	$fdne = "Field Email Address";
mysql_query("UPDATE member SET email='' WHERE username='$user_session'");

}else{
	$fdne = "All Field";
mysql_query("UPDATE member SET bank='', email='', hp=''  WHERE username='$user_session'");
}


$db->delete("unlockfield", "username='$user_session'");	
echo "<script>window.opener.location.reload();</script>";
    echo "<script>window.close();</script>";
	exit;
	}
?>
<?php 
}else{

?>	

<?php
$results = $_GET['result'];
if($results == "wrong_code") { 
echo "<br /><div class='alerts error notification' style='margin-left:13px; width:400px; font-size:12px;'><span>Incorrect verification code!</span></div>";
}
?>
<?php
$results = $_GET['result'];
if($results == "wait") { 
echo "<br /><div class='alerts info notification' style='margin-left:13px; width:400px; font-size:12px;'><span>You already request verification code before to your ".base64_decode($_GET['t']).", please try again a few hours to request again.</span></div>";
}
?>




<?php
$hp = $db->dataku("hp", $user_session);
$email = $db->dataku("email", $user_session);
?>


<article class="module width_full" style="width:450px">
			<header>
			  <h3><img src="../images/bullet_black.png" />&nbsp;&nbsp;<?php echo $LANG["unlockfield"]; ?></h3> 
			</header>
			
				<div class="module_content" style="width:410px;overflow:visible;">
						<form name="gprofile" id="gprofile" method="post" action="?go=unlock&do=check"/>
						<fieldset>
							<label>Unlock Field :</label>
							<select name="fields" id="fields" style="width:250px" required='required'>
       <option value="" selected="selected">[ Select Field ]</option>
       <option value="1" >Payment Account</option>
	   <option value="2">Phone Number</option>
	   <option value="3">Email Account</option>
	   <option value="5">All</option>
		  </select> 
					<label>Send verification code to :</label>
							<select name="sendto" id="sendto" style="width:250px; background-color:#E6E6E6;" required='required'>
       <?php if($unlockpro == 0){ ?>
       <option value="0" ><?php echo $email; ?></option>
       <?php } else{ ?>
	   <option value="1"><?php echo $hp; ?></option>
       <?php } ?>
		  </select> 		
							
						
						<div id='gprofile_fields_errorloc' style="font-family:Tahoma,Geneva,Arial,sans-serif;font-size:11px; line-height:150%; color:#D72D2D; margin-left:8px;" ></div>
						<div id='gprofile_pincode_errorloc' style="font-family:Tahoma,Geneva,Arial,sans-serif;font-size:11px; line-height:150%; color:#D72D2D; margin-left:8px;" ></div>
						</fieldset>
						<div class="clear"></div>
				</div>
				<footer>
			
				<div class="submit_link">
				<button class='primapcm' name='submit' type='submit'><?php echo $LANG["send"]; ?></button>&nbsp;&nbsp;<a href="#" onclick="window.close()"><button class='primapc2m' type='reset'><?php echo $LANG["cancel"]; ?></button></a>
				</div>
				
			</footer>
				</form>
			
	  </article><!-- end of post new article -->
<?
}
}
?>
</sectiony>	  
<?php ob_flush(); ?>