Your IP : 216.73.216.26


Current Path : /home2/wtmwscom/www/member/
Upload File :
Current File : /home2/wtmwscom/www/member/view_profile_1.php

<?php
$title = "Profile";
include 'header.php';
include_once('lib/ps_pagination.php');
//$pin_type =  array('a'=>10000,'b'=>25000,'c'=>50000,'d'=>100000,);
$uid = $_SESSION['userid'];
$result = mysqli_query($connection, "SELECT * FROM user WHERE uid='" . $uid . "'");
$row = mysqli_fetch_object($result);
$country = mysqli_fetch_object(mysqli_query($connection, "SELECT short_name FROM country WHERE country_id='$row->country'"))->short_name;
$refer = mysqli_fetch_object(mysqli_query($connection, "SELECT login_id, name, mobile, email FROM user WHERE uid='$row->refer_id'"));
?>
<style type="text/css">
    th{
        text-align: left;
    }
    .kyc-box{
        margin: 10px 10px 10px 10px; border: #0090EC solid medium;
    }
</style>
<?php
if ($_SESSION['is_paid'] !=0) {
    $result_pin = mysqli_query($connection, "SELECT t1.used_datetime as used_datetime, t2.package_amount as package_amount, t2.package_name as package_name FROM `dynamicpinnumber` t1 INNER JOIN pin_package t2 ON t1.type = t2.id WHERE t1.uid = '$uid' ORDER BY t1.used_datetime DESC LIMIT 1 ");
    $row_pin = mysqli_fetch_object($result_pin);
    $pin_date = date("d/m/Y h:i A", strtotime($row_pin->used_datetime));
    $pin_package = $row_pin->package_name . " - Rs." . $row_pin->package_amount;
    
} else {
    $pin_date = "-";
    $pin_package = "Free";
}
?>
<div class="">
    <h1>Club Type: <u>
            <?php
            switch ($row->type) {
                case 1: echo "Binary pair Income";
                    break;
                case 2: echo "Bike Club";
                    break;
                case 3: echo "Car Club";
                    break;
                case 4: echo "House Club";
                    break;
                default: echo "No Club";
                    break;
            }
            ?>
        </u></h1>

</div>
<h1>Your Top Up Details</h1>
<table style="width: 60%;">
    <thead>
        <tr>
            <th colspan="2" style="text-align: left;">Topup Details</th>
        </tr>
    </thead>
    <tbody>
        <tr class="light">
            <td>Topup Date</td>
            <td><?php echo $pin_date; ?></td>
        </tr>
        <tr class="dark">
            <td>Topup Plan</td>
            <td><?php echo $pin_package; ?></td>
        </tr>


    </tbody>
</table>

<?php if($_SESSION['is_paid'] !=0) :
     $query = "SELECT p.*,  u.name as name, u.login_id as login_id FROM user u INNER JOIN product_package p ON u.uid = p.uid WHERE p.uid='$uid'  ORDER BY p.datetime DESC ";
    $result_product_package = mysqli_query($connection, $query);
    $row_product_package= mysqli_fetch_object($result_product_package);
    
    ?>
<section>
    <h1>Your Product purchased details</h1>
<table style="width: 100%;">
    <thead>
        <tr>
              <th>User</th>
              <th>Package Name</th>
              <th>Product Name</th>
              <th>Receiver Name</th>
              <th>Mobile</th>
              <th>Tracking No.</th>
              <th>Courier</th>
              <th>Date</th>
            </tr>
    </thead>
    <tbody>
       <tr >
              <td><?php echo $row_product_package->name." ($row->login_id)";?></td>
              <td><?php echo $row_product_package->package_name;?></td>
              <td><?php echo $row_product_package->product_name;?></td>
              <td><?php echo $row_product_package->receiver_name;?></td>
              <td><?php echo $row_product_package->mobile;?></td>
              <td><?php echo $row_product_package->tracking_number;?></td>
              <td><?php echo $row_product_package->courier_name;?></td>
              <td><?php echo date("d/m/Y h:i A", strtotime($row_product_package->datetime));?></td>
            </tr>


    </tbody>
</table>
</section>
<?php endif;?>

<h1>Your Profile</h1>
<section>
    <table style="width: 60%;">
        <thead>
            <tr>
                <th colspan="2" style="text-align: left;">Sponsor Details</th>
            </tr>
        </thead>
        <tbody>
            <tr class="light">
                <td>Sponsor Id</td>
                <td><?php echo $refer->login_id; ?></td>
            </tr>
<!--            <tr class="dark">
                <td>Sponsor Name</td>
                <td><?php //echo $refer->name;  ?></td>
            </tr>
            <tr class="light">
                <td>Sponsor Mobile</td>
                <td><?php //echo $refer->mobile;  ?></td>
            </tr>
            <tr class="dark">
                <td>Sponsor Email</td>
                <td><?php //echo $refer->email;  ?></td>
            </tr>-->
        </tbody>
        <thead>
            <tr>
                <th colspan="2" style="text-align: left;">Account Details</th>
            </tr>
        </thead>
        <tbody>
            <tr class="light">
                <td>User id</td>
                <td><?php echo $row->login_id; ?></td>
            </tr>
            <tr class="dark">
                <td>Register Date</td>
                <td><?php echo date("d M, Y h:i A", strtotime($row->reg_date)); ?></td>
            </tr>
        </tbody>
        <thead>
            <tr>
                <th colspan="2" style="text-align: left;">Personal Details</th>
            </tr>
        </thead>
        <tbody>
            <tr class="light">
                <td>Name</td>
                <td><?php echo $row->name; ?></td>
            </tr>
            <tr class="dark">
                <td>Date of Birth</td>
                <td><?php echo date("d M, Y", strtotime($row->dob)); ?></td>
            </tr>
            <tr class="light">
                <td>Gender</td>
                <td><?php echo $row->gender; ?></td>
            </tr>
            <tr class="dark">
                <td>Email</td>
                <td><?php echo $row->email; ?></td>
            </tr>
            <tr class="light">
                <td>Phone</td>
                <td><?php echo $row->phone; ?></td>
            </tr>
            <tr class="dark">
                <td>Mobile</td>
                <td><?php echo $row->mobile; ?></td>
            </tr>
            <tr class="light">
                <td>Address</td>
                <td><?php echo $row->address; ?></td>
            </tr>
            <tr class="dark">
                <td>City</td>
                <td><?php echo $row->city; ?></td>
            </tr>
            <tr class="light">
                <td>District</td>
                <td><?php echo $row->district; ?></td>
            </tr>
            <tr class="dark">
                <td>State</td>
                <td><?php echo $row->state; ?></td>
            </tr>
            <tr class="light">
                <td>Country</td>
                <td><?php echo $country; ?></td>
            </tr>
            <tr class="dark">
                <td>Pin Code</td>
                <td><?php echo $row->pincode; ?></td>
            </tr>
        </tbody>
    </table>
</section>
<section>
    <h2>Document Details</h2>
    <?php echo getMessage(); ?>
    <?php
    $kyc_doc = 0;
    $pan_doc = 0;
    $cancel_cheque_doc = 0;
    $is_kyc_doc_edit = TRUE;
    $is_pan_doc_edit = TRUE;
    $is_cancel_cheque_doc_edit = TRUE;
    
    $kyc_result = mysqli_query($connection, "SELECT id, `uid`, `doc_type`, `file_name`,`file_path`, `create_date`, `status` FROM kyc_doc WHERE uid='$uid' AND is_delete=0");
    while ($kyc_row = mysqli_fetch_object($kyc_result)) {
        // kyc doc flags 1=> kyc, 2=>PAN, 3=> Cancel cheque
        if ($kyc_row->doc_type == 1) {
            $kyc_doc = $kyc_row->id;
            $is_kyc_doc_edit = is_kyc_edit($uid, $kyc_row->doc_type);
            ?>
            <div class="kyc-box">
                <p>
                    KYC doc <img src="./uploads/kyc_doc/<?php echo $kyc_row->file_name; ?>" width="400" />
                </p>
            </div>
            <?php
        } elseif ($kyc_row->doc_type == 2) {
            $pan_doc = $kyc_row->id;
            $is_pan_doc_edit = is_kyc_edit($uid, $kyc_row->doc_type);
            ?>
            <div class="kyc-box">
                <p>
                    PAN doc <img src="./uploads/kyc_doc/<?php echo $kyc_row->file_name; ?>" width="400" />
                </p>
            </div>
            <?php
        } elseif ($kyc_row->doc_type == 3) {
            $cancel_cheque_doc = $kyc_row->id;
            $is_cancel_cheque_doc_edit = is_kyc_edit($uid, $kyc_row->doc_type);
            ?>
            <div class="kyc-box">
                <p>
                    Cancel Cheque doc <img src="./uploads/kyc_doc/<?php echo $kyc_row->file_name; ?>" width="400" />
                </p>
            </div>
            <?php
        }
    }
    ?>
<?php if ($is_kyc_doc_edit) : ?>
        <form action="./kyc_add_model.php" method="post" enctype="multipart/form-data">
            <div class="kyc-box">
                <p>
                <h3>Upload KYC doc</h3>
                <label for="kyc_doc">Upload any address proof (Aadhar card or Driving license or voter Id card or any address proof).</label>
                <input type="file" name="receipt" id="kyc_doc" required="required"  />
                </p>
                <p>
                    <input type="hidden" name="doc_type" value="1" />
                    <input type="hidden" name="update_id" value="<?php echo $kyc_doc; ?>" />
                    <label for=""></label>
                    <input type="submit" name="submit" value="Upload" />
                </p>
            </div>
        </form>
<?php endif; ?>
<?php if ($is_pan_doc_edit) : ?>
        <form action="./kyc_add_model.php" method="post" enctype="multipart/form-data">
            <div class="kyc-box">
                <p>
                    <label for="pan_doc">Upload PAN doc</label>
                    <input type="file" name="receipt" id="pan_doc" required="required"  />
                </p>
                <p>
                    <input type="hidden" name="doc_type" value="2" />
                    <input type="hidden" name="update_id" value="<?php echo $pan_doc; ?>" />
                    <label for=""></label>
                    <input type="submit" name="submit" value="Upload" />
                </p>
            </div>
        </form>
<?php endif; ?>
<?php if ($is_cancel_cheque_doc_edit) : ?>
        <form action="./kyc_add_model.php" method="post" enctype="multipart/form-data">
            <div class="kyc-box">
                <p>
                    <label for="cancel_cheque_doc">Upload Cancel Cheque doc</label>
                    <input type="file" name="receipt" id="cancel_cheque_doc" required="required"  />
                </p>
                <p>
                    <input type="hidden" name="doc_type" value="3" />
                    <input type="hidden" name="update_id" value="<?php echo $cancel_cheque_doc; ?>" />
                    <label for=""></label>
                    <input type="submit" name="submit" value="Upload" />
                </p>
            </div>
        </form>
<?php endif; ?>

</section>
<?php include 'footer.php'; ?>
<?php

function is_kyc_edit($uid, $doc_type) {
    $date_today = new DateTime(date("Y-m-d"));
    $kyc_create_date = mysqli_fetch_object(mysqli_query($connection, "SELECT `create_date` FROM kyc_doc WHERE uid='$uid' AND doc_type='$doc_type' ORDER BY create_date ASC LIMIT 1 "))->create_date;
    $first_kyc_create_date = new DateTime($kyc_create_date);
//    if ($date_today->diff($first_kyc_create_date)->format("%a") > 7) {
//        $is_kyc_doc_edit = TRUE;
//    }
    return $date_today->diff($first_kyc_create_date)->format("%a") > 7 ? FALSE : TRUE;
}
?>