I'm sending GET strings from another webpage which is mydomain.com/read_data.php?symbol=abc.
Below is my code. Are they secure enough to prevent XSS and other code-related security issues?
if ( $_SERVER['REQUEST_METHOD'] == 'GET' ) {
    if ( isset( $_GET['symbol'] ) && filter_var($_GET['symbol'], FILTER_SANITIZE_STRING) ) {
        $cur_name = filter_var($_GET['symbol'], FILTER_SANITIZE_STRING);
        
    } else {
        
        // redirect them to your homepage
        header('location: /');
        exit;
    }
} else {
    
    // redirect them to your homepage
    header('location: /');
    exit;
}
Or should I be using FILTER_SANITIZE_SPECIAL_CHARS?
