I have a PHP script that dynamically generates a TSV file based on database content (using something similar to https://stackoverflow.com/a/125125/701867). However, I only want this page to be accessible to certain people.
The rest of the website uses WordPress as it's membership system, so ideally I'd like to tie it in with this.
How would I go about making this script only accessible to specific WordPress users?