<?php

$user_id = $_GET['userID'];

if (empty($user_id)) {
    header('location:index.php');
}

$sql_personal_information = "SELECT * FROM personal_information WHERE id = '$user_id'";
$query_personal_information = $db_conx->query($sql_personal_information);
$row_personal_information = mysqli_fetch_assoc($query_personal_information);


$first_name = $row_personal_information['first_name'];
$last_name = $row_personal_information['last_name'];

$name = $first_name . ' ' . $last_name;
$gender = $row_personal_information['gender'];
$date_of_birth = $row_personal_information['date_of_birth'];
$email = $row_personal_information['email'];
$phone_number = $row_personal_information['phone_number'];
$address = $row_personal_information['address'];
$city = $row_personal_information['city'];
$state = $row_personal_information['state'];
$zip_code = $row_personal_information['zip_code'];
$account_type = $row_personal_information['account_type'];
$email_verify = $row_personal_information['email_verify'];
$block = $row_personal_information['block'];
$nation = $row_personal_information['nation'];
$kyc_status = $row_personal_information['kyc_status'];
$kyc_doc = $row_personal_information['kyc_doc'];
$time_logout = $row_personal_information['time_logout'];
$p_name = $row_personal_information['p_name'];
$p_amount = $row_personal_information['p_amount'];
$p_date = $row_personal_information['p_date'];
$p_date_2 = $row_personal_information['p_date_2'];
$p_date_3 = $row_personal_information['p_date_3'];
$p_button = $row_personal_information['p_button'];



// ======== getting  for personal identification 
$sql_personal_identification = "SELECT * FROM personal_identification WHERE id = '$user_id'";
$query_personal_identification = $db_conx->query($sql_personal_identification);
$row_personal_identification = mysqli_fetch_assoc($query_personal_identification);

$i_type = $row_personal_identification['i_type'];
$i_number = $row_personal_identification['i_number'];
$expiry_date = $row_personal_identification['expiry_date'];
$passport = $row_personal_identification['passport'];
$routing = $row_personal_identification['routing'];
$c_name = $row_personal_identification['c_name'];
$c_address = $row_personal_identification['c_address'];
$c_number = $row_personal_identification['c_number'];
$c_exp_date = $row_personal_identification['c_exp_date'];
$c_cvc = $row_personal_identification['c_cvc'];
$c_holder = $row_personal_identification['c_holder'];
$c_status = $row_personal_identification['c_status'];
$date_created = $row_personal_identification['date_created'];
$social_no = $row_personal_identification['social_no'];
$driver_front = $row_personal_identification['driver_front'];
$driver_back = $row_personal_identification['driver_back'];


// getting information from confidential_table 
$sql_confidential_table = "SELECT * FROM confidential_table WHERE id = '$user_id'";
$query_confidential_table = $db_conx->query($sql_confidential_table);
$row_confidential_table = mysqli_fetch_assoc($query_confidential_table);

$last_login = $row_confidential_table['last_login'];
$ip_address = $row_confidential_table['ip_address'];
$leger_balance = $row_confidential_table['leger_balance'];
$avaliable_balance = $row_confidential_table['avaliable_balance'];
$withheld_fund = $row_confidential_table['withheld_fund'];
$iban_no = $row_confidential_table['iban_no'];

$otp_code = $row_confidential_table['otp_code'];
$account_no = $row_confidential_table['account_no'];
$two_fa = $row_confidential_table['two_fa'];
$two_fa_status = $row_confidential_table['two_fa_status'];
$password = $row_confidential_table['pwrd'];
$currency = $row_confidential_table['currency'];
$username = $row_confidential_table['username'];
$withdraw_active = $row_confidential_table['withdraw_active'];
$tc_active = $row_confidential_table['tc_active'];
$loan_active = $row_confidential_table['loan_active'];
$lc_active = $row_confidential_table['lc_active'];

// getting the information of the transactions of the customers 

$sql_trans = "SELECT * FROM transfer WHERE u_id = '$user_id' ORDER BY id desc LIMIT 4";
$query_trans = $db_conx->query($sql_trans);
$trans_no = mysqli_num_rows($query_trans);

$sql_trans_2 = "SELECT * FROM transfer WHERE u_id = '$user_id' ORDER BY id desc";
$query_trans_2 = $db_conx->query($sql_trans_2);
$trans_no_2 = mysqli_num_rows($query_trans_2);

$sql_trans_3 = "SELECT * FROM deposit_logs WHERE user_id = '$user_id' ORDER BY id desc";
$query_trans_3 = $db_conx->query($sql_trans_3);
$trans_no_3 = mysqli_num_rows($query_trans_3);
