<?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

$ref_code = $_GET['ref_code'];
               
$q = "SELECT *
FROM user
WHERE ref_code='$ref_code'";
$result = $mysqli-> query($q);
if ($result -> num_rows > 0)
{
	while($record = $result -> fetch_assoc())
	{               
        $id = $record['id'] ;
        $sponsor_code = $record['sponsor_code'] ;
        $ref_code = $record['ref_code'] ;
        $profile_image = $record['profile_image'] ;
        $name = $record['name'];
        $nick_name = $record['nick_name'];
        $email = $record['email'];
        $password = $record['password'];
        $phone_number = $record['phone_number'];
        $paid = $record['paid'];
        $address = $record['address'];
        $state = $record['state'];
        $bank_type = $record['bank_type'];
        $acc_no = $record['acc_no'];
        $acc_holder = $record['acc_holder'];
        $type_of_user = $record['type_of_user'];
?> 

<div class="row">
    <div class="col-lg-12">
        <div class="card">
            <div class="card-body">
                <form method="post" action="../Controller/Database_sql.php" enctype="multipart/form-data">
                    <div class="form-body">
                        <h3 class="card-title">Profile </h3>
                        <hr>
                                        
                        <div class="row p-t-20">
                            <div class="col-md-12">
                                <div class="form-group">
                                    <img src="../Controller/uploads/<?php echo $profile_image; ?>" 
                                    width="100" height="100" class="img-circle">
                                </div>
                            </div>                                            
                        </div>
                                        
                        <div class="row p-t-20">
                            <div class="col-md-4">
                                <div class="form-group">
                                    <label class="control-label">Type Of User </label>                                                   
                                    <input type="text" class="form-control" value="<?php echo $type_of_user; ?>" readonly>
                                </div>
                            </div>
                            <div class="col-md-4">
                                <div class="form-group">
                                    <label class="control-label">Refferal Link</label> 
                                    <!--button onclick="myFunction()">Copy text</button-->

                                    <input id="myInput" type="text" class="form-control" 
                                    value="https://mydayanas2u.com/Web/pendaftaran/?username=<?php echo $ref_code; ?>" readonly>

                                    <script>
                                    function myFunction() 
                                    {
                                        var copyText = document.getElementById("myInput");
                                        copyText.select();
                                        copyText.setSelectionRange(0, 99999)
                                        document.execCommand("copy");
                                        alert("Copied the text: " + copyText.value);
                                    }
                                    </script>
                                </div>
                            </div>
                            <div class="col-md-4">
                                <div class="form-group">
                                    <label class="control-label">Expired Date / Status Of User</label>                                         
                                    <input type="text" class="form-control" value="<?php echo $expired_date_show;?> / <?php echo $user_status;?>" readonly>
                                </div>
                            </div>
                        </div>
                                        
                        <div class="row p-t-20">
                            <div class="col-md-6">
                                <div class="form-group">
                                    <label class="control-label">Sponsor ID</label>
                                    <input type="text" class="form-control" value="<?php echo $sponsor_code; ?>" readonly>
                                </div>
                            </div>
                            <div class="col-md-6">
                                <div class="form-group">
                                    <label class="control-label">Refferal ID</label>
                                    <input type="text" class="form-control" name="ref_code" value="<?php echo $ref_code; ?>" readonly>
                                </div>
                            </div>
                        </div>

                        <div class="row p-t-20">
                            <div class="col-md-6">
                                <div class="form-group">
                                    <label class="control-label">Email</label>
                                    <input type="text" class="form-control"  name="email" value="<?php echo $email; ?>" readonly>
                                </div>
                            </div>
                            <div class="col-md-6">
                                <div class="form-group">
                                    <label class="control-label">Full Name</label>
                                    <input type="text" class="form-control"  name="name" value="<?php echo $name; ?>" readonly>
                                </div>
                            </div>
                        </div>

                        <div class="row p-t-20">
                                            
                            <div class="col-md-6">
                                <div class="form-group">
                                    <label class="control-label">Username</label>
                                    <input type="text" class="form-control"  name="nick_name" value="<?php echo $nick_name; ?>" readonly>
                                </div>
                            </div>
                            <div class="col-md-6">
                                <div class="form-group">
                                    <label class="control-label">Phone Number</label>
                                    <input type="text" class="form-control"  name="phone_number" value="<?php echo $phone_number; ?>" readonly>
                                </div>
                            </div>
                        </div>

                        <div class="row p-t-20">
                            <div class="col-md-6">
                                <div class="form-group">
                                    <label class="control-label">Address</label>
                                    <textarea type="text"  style="width:100%;" rows="2" cols="39" name="address" readonly><?php echo $address; ?>
                                    </textarea>
                                </div>
                            </div>
                            <div class="col-md-6">
                                <div class="form-group">
                                    <label class="control-label">Negeri</label>
                                    <input type="text" class="form-control"  name="state" value="<?php echo $state; ?>" readonly>
                                </div>
                            </div>
                        </div>

                        <div class="row p-t-20">
                            <div class="col-md-4">
                                <div class="form-group">
                                    <label class="control-label">Type Of Bank</label>
                                    <input type="text" class="form-control"  name="bank_type" value="<?php echo $bank_type; ?>" readonly>
                                    </select>
                                </div>
                            </div>
                            <div class="col-md-4">
                                <div class="form-group">
                                    <label class="control-label">Account Bank Number</label>
                                    <input type="text" class="form-control"  name="acc_no" value="<?php echo $acc_no; ?>" readonly>
                                </div>
                            </div>
                            <div class="col-md-4">
                                <div class="form-group">
                                    <label class="control-label">Account Holder Name</label>
                                    <input type="text" class="form-control"  name="acc_holder" value="<?php echo $acc_holder; ?>" readonly>
                                </div>
                            </div>
                        </div>

                        <input type="hidden" class="form-control"  name="id" value="<?php echo $id; ?>">
                        <input type="hidden" class="form-control"  name="ref_code" value="<?php echo $ref_code; ?>">

                    </div>
                    <div class="form-actions">
                    </div>
                </form>
                <a href="list_of_downline.php" class="btn btn-primary">  Back</a>
            </div>
        </div>
    </div>
</div>
<?php
    }
}
?>						
<!-- ============================================================== -->
<!-- End PAge Content -->

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

<!-- 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>