<?php 
if(isset($_SESSION['j_admin']) || isset($_SESSION['j_admin'])){
if(isset($_SESSION['j_admin'])){ $user=$_SESSION['j_admin']; }else{$user=$_SESSION['j_admin'];}
    $sql25="SELECT * from j_users WHERE 
    j_id='".$user."'"; //  
    $result25 = runSQL($sql25);
    $data25 = mysqli_fetch_array($result25);
    $reg_date = $data25['j_date'];
    $referrer_id = $data25['j_referrer_id'];
    $id = $data25['j_id'];
    $wallet = $data25['j_wallet'];
    $wallet_usd = $data25['j_wallet_usd'];
    $wallet_btc = $data25['j_wallet_btc'];
    $wallet_eth = $data25['j_wallet_eth'];
    $wallet_ltc = $data25['j_wallet_ltc'];
    $sms_unit = $data25['j_sms_unit'];
    $username = $data25['j_username'];
    $email = $data25['j_email'];
    $phone = $data25['j_phone'];
    $bvn = $data25['j_bvn'];
    $firstname = $data25['j_firstname'];
    $lastname = $data25['j_lastname'];
    $name = "$firstname $lastname"; $name = trim($name);
    $gender = $data25['j_gender'];
   // $profession = $data25['j_profession'];
    $passport = $data25['j_passport'];
    $valid_id = $data25['j_valid_id'];
    $dob = $data25['j_dob'];
    $logins = $data25['j_logins'];
    $last_seen = $data25['j_last_seen'];
    $last_seen_old = $data25['j_last_seen_update'];
    $r_mail = $data25['j_r_mail'];
    $r_sms = $data25['j_r_sms'];
    $blocked = $data25['j_blocked'];
    $deleted = $data25['j_deleted'];
    $status = $data25['j_status'];
    $country = $data25['j_country'];
    $state = $data25['j_state'];
    $address = $data25['j_address'];
    $b_name = $data25['j_b_name'];
    $b_no = $data25['j_b_no'];
    $b_type = $data25['j_b_type'];
    $b_country = $data25['j_b_country'];
    $b_state = $data25['j_b_state'];
    $b_city = $data25['j_b_city'];
    $b_email = $data25['j_b_email'];
    $b_phone = $data25['j_b_phone'];
    $m_request = $data25['j_m_request'];
    $m_approve = $data25['j_m_approve'];
    //
    $currency_in_use = $data25['j_currency'];
    $currency_code_in_use = $data25['j_currency_code'];
    $currency_sort_in_use = $data25['j_currency_sort'];    
    if(!empty($firstname)){
        $short_name = trim("".mb_substr($firstname,0,1)."".mb_substr($lastname,0,1)."");
        $short_name = strtoupper($short_name);
    }else{
        $short_name = trim("".mb_substr($username,0,1)."");
        $short_name = strtoupper($short_name);   
    }
    // 
    $profile_edit_url = "http://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]"; //complete url with get
    //if(empty($firstname) || empty($username) || empty($country) || empty($address)){
    if(empty($firstname) || empty($username) || empty($country) || empty($currency_in_use) ){
        if(strpos($profile_edit_url, 'profile-edit') !== false){ }else{
            header('location: '.$dir.'profile-edit/');
			?>
			<script>
				window.location.href='<?php echo "".$dir."profile-edit/"; ?>';
			</script>
			<?php 
        }
    }
    
    
    function is_passport ($id){ 
	$sql4="SELECT count(*) as sum from j_users WHERE j_id='".$id."' AND j_passport !=''"; //check 
    $result4 = runSQL($sql4);
    $data4 = mysqli_fetch_array($result4);
    $sum4 = $data4['sum'];
    if($sum4 > 0){
        return 1;
        } else {
            return 0;
        }
    }  
}

//not logged in
function get_country(){ 
 	//$mfc_browser = $_SERVER['HTTP_USER_AGENT'];
	$mfc_ip=$_SERVER['REMOTE_ADDR'];
	$geopluginURL='http://www.geoplugin.net/php.gp?ip='.$mfc_ip;
	$addrDetailsArr = unserialize(file_get_contents($geopluginURL)); 
	//$mfc_city = $addrDetailsArr['geoplugin_city']; 
	$mfc_country = $addrDetailsArr['geoplugin_countryName'];
	return $mfc_country;
}
//
?>