Viewing File: /home/rareljzw/public_html/include/function.php

<?php
require_once('config.php');
// require_once('userClass.php');
$conn = dbConnect();

//USERS DETAILS WITH ACCOUNT NUM
function userSession($value){
    $conn = dbConnect();
    $username = $_SESSION['nftwallet'];
    $sql ="SELECT * FROM users WHERE username=:username";
    $stmt = $conn->prepare($sql);
    $stmt->execute([
        'username'=>$username
    ]);



    $row = $stmt->fetch(PDO::FETCH_ASSOC);
    return $row[$value];

}

function transStatus($result){

    if ($result['wallet_status'] == '0') {
        return '<span class="text-yellow">Pending</span>';
    }
    if($result['wallet_status'] == '1'){
        return  '<span class="text-green">Approved</span>';
    }

    if($result['wallet_status'] == '2') {
        return '<span class="text-red">On Hold</span>';
    }

    if($result['wallet_status'] == '3') {
        return '<span class="text-red">Rejected</span>';
    }

}



function toast_alert($type,$msg, $title = false){
    if ($title === false){
        $alert_title = "Ops!!";
    }else{
        $alert_title = $title;
    }

    $toast = '<script type="text/javascript">
        $(document).ready(function(){
        
          swal({
            type: "'.$type.'",
            title: "'.$alert_title.'",
            text: "'.$msg.'",
            padding: "2em",
          });
        });
    </script>';
    echo $toast;
}


function notify_alert($msg,$colorType,$duration,$action = false){
    if($colorType === 'success'){
        $color = "#1abc9c";
    }elseif ($colorType  === 'danger'){
        $color = "#e7515a";
    }elseif ($colorType === 'warning'){
        $color = "#e2a03f";
    }elseif ($colorType === 'info'){
        $color = "#2196f3";
    }else{
        $color = "#4361ee";
    }

    if($action === false){
        $actionMsg = "DISMISS";
    }else{
        $actionMsg = $action;
    }



    $toast = '<script type="text/javascript">
        $(document).ready(function(){
        Snackbar.show({
                text: "'.$msg.'",
                actionTextColor: "#fff",
                backgroundColor: "'.$color.'",
                pos: "top-right",
                duration: "'.$duration.'",
                actionText: "'.$actionMsg.'"
            });
        });
    </script>';
    echo $toast;
}




//DEPOSIT TRANSACTION STATUS
function depositStatus($result){
    if ($result['wallet_status'] === '0') {
        return '<span class="badge outline-badge-secondary shadow-none col-12">In Progress</span>';
    }
    if($result['wallet_status'] === '2'){
        return  '<span class="badge outline-badge-danger shadow-none col-12">Hold</span>';
    }

    if($result['wallet_status'] === '3') {
        return '<span class="badge outline-badge-danger shadow-none col-12">Cancelled</span>';
    }

    if($result['wallet_status'] === '1') {
        return '<span class="badge outline-badge-primary shadow-none col-12">Completed</span>';
    }
}
Back to Directory File Manager
<