At the moment, I have a directory that's password protected by .htaccess and .htpasswd. The problem with this is that when a visitor comes to my site, they get an ugly inbuilt Secure Area message rather than going through a friendlier-looking login page.
The only other way I know to password protect online is using PHP files that redirect if the user doesn't have a login cookie, but the problem with this is that although it protects pages of the site, it doesn't protect other site content (such as image and PDF files).
How can I make sure that all files within a directory are protected by a login while still presenting that login in a user-friendly way?