Dave wrote:
Hello,
I'm using php and apache2 on a freebsd box. I know about .htaccess that the web server can provide, but i'm looking for something php can do, i want it to pop up a page when a user requests certain files, asking for a username and password.

http://www.php.net/features.http-auth has some nice examples, though the "popup" is the same as using htaccess.

I am also interested in blocking direct access to the files, for instance if someone puts in their direct url they should not be retrievable, but instead php should give an error msg.

If it's in a publicly accessible folder and only a php file to "protect" it, it won't work.

Put the files in a non-public folder (outside the webroot) and get php to "pipe" them in.

http://php.net/readfile or http://php.net/fpassthru will work for small files. For larger files you will need to use http://php.net/fread (specifically the loop example) so you don't blow out memory.


--
Postgresql & php tutorials
http://www.designmagick.com/

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to