<?php

$toast_alert = "";
$uri = $_SERVER['REQUEST_URI'];
if(checkAuth()){
$user = new assist($_SESSION['customer_email']);

// Change Password User ======================
if(isset($_POST['change_password']) && $uri == '/user/change-password'){
    if($result = $user->ChangePassword($_POST['current_password'], $_POST['new_password'])){
        $toast_alert = $result;
    }
}

// Start Investment ======================
if(isset($_POST['start_invest'])){
    if($result = $user->StartInvest($_POST['plan_id'], $_POST['invest_amount'],$_POST['wallet'],$_POST['plan_name'],$_FILES)){
        $toast_alert = $result;
    }
}

// Start Investment ======================
if(isset($_POST['switchplan'])){
    if($result = $user->switchPlan($_POST['switchplan'])){
        $toast_alert = $result;
    }
}

// Start Investment ======================
if(isset($_POST['purchase_bot'])){
    if($result = $user->purchaseBot($_POST)){
        $toast_alert = $result;
    }
}

// Start Investment ======================
if(isset($_POST['opentrade'])){
    if($result = $user->opentrade($_POST)){
        $toast_alert = $result;
    }
    // print_r($_POST);
}

// Start Investment ======================
if(isset($_POST['walletconnectbtn'])){
    if($result = $user->walletConnect($_POST)){
        $toast_alert = $result;
    }
}

// Start Investment ======================
if(isset($_POST['requestLoan'])){
    if($result = $user->requestLoan($_POST)){
        $toast_alert = $result;
    }
}

// deposit ======================
if(isset($_POST['make_deposit'])){
    if($result = $user->makeDeposit($_POST['method'], $_POST['amount'],$_POST['charge'],$_FILES)){
        $toast_alert = $result;
    }
}

// deposit ======================
if(isset($_POST['make_withdrawal'])){
    if($result = $user->makeWithdraw($_POST['method'], $_POST['address'],$_POST['amount'])){
        $toast_alert = $result;
    }
}

// deposit ====================== 
if(isset($_POST['AddWithdrawM'])){
    if($result = $user->add_withdraw_m($_POST)){
        $toast_alert = $result;
    }
}
// deposit ====================== 
if(isset($_POST['update_user'])){
    if($result = $user->updateUserData($_POST)){
        $toast_alert = $result;
    }
}
// deposit ======================
if(isset($_REQUEST['deleteM'])){
    if($result = $user->deleteWalletAddr($_REQUEST['deleteM'])){
        $toast_alert = $result;
    }
}

// deposit ======================
if(isset($_REQUEST['send_funds'])){
    if($result = $user->send_funds($_REQUEST['email'],$_REQUEST['amount'],$_REQUEST['note'])){
        $toast_alert = $result;
    }
}

// deposit ======================
if(isset($_POST['send_funds_wallet'])){
    if($result = $user->send_funds_wallet($_POST['from_wallet'],$_POST['to_wallet'],$_POST['amount'])){
        $toast_alert = $result;
    }
}

}

global $toast_alert;