LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   PHP/CGI help (https://www.linuxquestions.org/questions/programming-9/php-cgi-help-28603/)

ugenn 08-23-2002 08:33 AM

PHP/CGI help
 
How do I access a file using local file paths instead of the URL
path from a PHP script? I'm trying to allow only trusted (logged on)
users to access certain restricted files so the files must not be
directly accessible from a URL.

eg. I have the following directory layout...

~/public_html
~/private_files

public_html is mapped by the web server to my ~$USER
directory.

How can a script from inside public_html access the private_files
directory.

no2nt 08-23-2002 08:45 AM

You can use fopen, readfile, ....

Look here for working with local files:
http://www.php.net/manual/en/ref.filesystem.php

j-ray 08-23-2002 02:12 PM

why don't u write a script asking for authorization, then u include "authorization.php"; in the private files. so nothing else will be displayed to visitors not logged in.
if u're working with apache there might be a chance of excluding unknown vistors using the .htaccess file. see apache manual for that.
cheers,
jens


All times are GMT -5. The time now is 02:23 AM.