checking member level via php

could a dev drop in and give me the function I could use to verify if a user has a specific valid subscription?

i didn't really like the idea of having just a masked download link (couldn't get it to work but i'm guessing you're using http redirects, right?) so I wrote a little script that allows me to store files behind my server root and only allowing subscribers to download.

One major limitation is I can't limit downloads to a specific subscription. knowing the above would help and maybe allow me to contribute something to this