I\'m making a members area for my site and I have it already running. I authenticate members using mysql and php and this works really well.
But now problems occurs,
Check out Using PHP/Apache to restrict access to static files (html, css, img, etc). I think the approach taken there is pretty similar to your problem.