<?php include("../Header/Session.php"); ?>
<?php include("../Header/Connection.php"); ?>

<!DOCTYPE html>
<html lang="en">
<?php include ("../Header/head.php"); ?>
<body class="skin-default fixed-layout">

<!-- Main wrapper - style you can find in pages.scss -->
<div id="main-wrapper">    
<?php include ("../Header/header.php"); ?>
<?php include ("../Header/left_menu.php"); ?>
<?php include ("../Header/right_sidebar.php"); ?>
        
<!-- Page wrapper  -->
<div class="page-wrapper">
<!-- Container fluid  -->
<div class="container-fluid">
<!-- Bread crumb and right sidebar toggle -->
<!--?php include ("../Header/breadcumb.php"); ?-->
<br><br>
<!-- End Bread crumb and right sidebar toggle -->
    
<!-- Start Page Content -->
<!-- ============================================================== -->

<?php
$user_ref_code = $_GET['user_ref_code'];

if ( $level != '1')
{
    if ($user_ref_code != $ref_code)
    {
        echo "<script type='text/javascript'>alert('You cannot view other user profile');</script>";
        echo "<script type='text/javascript'> document.location='user_dashboard.php'; </script>";
		exit();
	}
}

$sql_user = "SELECT *
FROM user
WHERE ref_code='$user_ref_code'";
$result_user = $mysqli->query($sql_user);
if ($result_user->num_rows > 0)
{
    while($row_user = $result_user -> fetch_assoc())
    {    	         
    $id = $row_user['id'];
    $ref_code = $row_user['ref_code'];
    $sponsor_code = $row_user['sponsor_code'];
    $sponsor_last_name = $row_user['sponsor_last_name'];
    $level = $row_user['level'];
    $type_of_user = $row_user['type_of_user'];
    $rank = $row_user['rank'];
    $name = $row_user['name'];
    $last_name = $row_user['last_name'];
    $email = $row_user['email'];
    $password = $row_user['password'];
    $phone_number = $row_user['phone_number'];
    $phone_number_2 = $row_user['phone_number_2'];
    $no_ic = $row_user['no_ic'];
    $ic_front = $row_user['ic_front'];
    $ic_back = $row_user['ic_back'];
    $address = $row_user['address'];
    $address_2 = $row_user['address_2'];
    $state = $row_user['state'];
    $area = $row_user['area'];
    $postcode = $row_user['postcode'];
    $country = $row_user['country'];
    $birth_date = $row_user['birth_date'];
    $bank_type = $row_user['bank_type'];
    $acc_no = $row_user['acc_no'];
    $acc_holder = $row_user['acc_holder'];
    $herbalist_news = $row_user['herbalist_news'];
    $purchase_status = $row_user['purchase_status'];
    $spouse_status = $row_user['spouse_status'];
    $wallet_status = $row_user['wallet_status'];
    $status = $row_user['status'];
    $created_date = $row_user['created_date'];		   
?> 

<div class="row">
<div class="col-lg-12">
<div class="card">
    <div class="card-body">
        <form method="post" action="../Controller/Database_sql.php" onsubmit="return confirm('Do you want to proceed?');" enctype="multipart/form-data">
            <div class="form-body">
                <h3 class="card-title">Reset Password</h3>
                <hr>
                                        
                <div class="row p-t-20">
                    <div class="col-md-6">
                        <div class="form-group">
                            <label class="control-label">Current Password </label>                                                   
                            <input type="password" class="form-control" name="current_password" required>
                        </div>
                    </div>                   
                    <div class="col-md-6">
                        <div class="form-group">
                            <label class="control-label">New Password</label>
                            <input type="password" class="form-control"  name="new_password" required>
                        </div>
                    </div>
                    <div class="col-md-6">
                        <div class="form-group">
                            <label class="control-label">Retype New Password</label>
                            <input type="password" class="form-control" id="retype_new_password" name="retype_new_password"  required>
                        </div>
                    </div>
                </div>
            </div>
            <div class="form-actions">
                <input type="hidden" class="form-control"  name="id" value="<?php echo $id; ?>">
                <input type="hidden" class="form-control"  name="ref_code" value="<?php echo $user_ref_code; ?>">
                <button name="Update_User_Password" class="btn btn-success"><i class="fa fa-check"></i> Update</button>
            </div>
        </form>
    </div>
</div>
</div>
</div>
<?php
}
}
else
{
echo mysql_error();
}
?>						
<!-- ============================================================== -->
<!-- End PAge Content -->

</div>
<!-- End Container fluid  -->
</div>
<!-- End Page wrapper  -->

<script>
	window.onload = () => 
	{
	 const mypassword = document.getElementById('retype_new_password');
	 mypassword.onpaste = e => e.preventDefault();

	}
</script>

<!-- Footer Start-->
<?php include ("../Footer/footer.php"); ?>
<!-- Footer End-->

</div>
<!-- End Wrapper -->
<!-- All Jquery -->
    

<!-- All Jquery Start-->
<?php include ("../Header/all_jquery.php"); ?>
<!-- All Jquery End-->

</body>

</html>