application/Helpers/Server_helper.php
/**
     * Include helper functions for server methods
     * POST, GET, REQUEST etc
     */
Include helper functions for server methods
POST, GET, REQUEST etc
Include helper functions for server methods POST GET REQUEST etc
public static function postParamsExist(array $postArray, array $params, bool $checkCSRF = true): bool {
        if($checkCSRF) $params[] = 'csrf_token';
        foreach ($params as $param) 
            if(!isset($postArray[$param])) return false;
        return ($checkCSRF && hash_equals($_SESSION['csrf_token'], $postArray['csrf_token'] ?? '')) 
                || !$checkCSRF;
    }
public static function postParamsExist ( array $ postArray , array $ params , bool $ checkCSRF = true ) : bool { if ( $ checkCSRF ) $ params [ ] = 'csrf_token' ; foreach ( $ params as $ param ) if ( ! isset ( $ postArray [ $ param ] ) ) return false ; return ( $ checkCSRF && hash_equals ( $ _SESSION [ 'csrf_token' ] , $ postArray [ 'csrf_token' ] ?? '' ) ) || ! $ checkCSRF ; }
Include helper functions for server methods
 POST, GET, REQUEST etc
Include helper functions for server methods POST GET REQUEST etc
// If token required and equal to session token OR not required -- return true