How to use/access a directory above the web root?

Hi experts,

I'm trying to create a script to ease the connection to MySQL for my users (without having to download an ODBC driver). And I've created a php-script that creates XML files out of the MySQL queries.

It works fine at the moment, but I'm concerned about the security and wonder if I could save the files to a directory outside the web root and access it from there instead. I've been googling the matter, but not found a solution.

I assume in PHP I would just save the XMLs to "/home/safedir/" instead of "/home/www/" but how would I connect to it again from an offline application (Excel VBA)? Is it even possible?

Regards,
eX.
Gaute RønningenOwner, DeveloperAsked:
Who is Participating?
 
-null-Connect With a Mentor Commented:
Hi,

You would put your file into your safedir, then use another script to retrieve the contents and pass them back, using something like file_get_contents.  This way, the file is still available, but it isn't sat on a public url.  You can then use sessions or similar to control access to the proxying script.

-null-
0
 
shobinsunCommented:
Hi,

you can use include() method.

for example: include('/root/filename1');  (in /var/www/html/filname.php)
0
 
Gaute RønningenOwner, DeveloperAuthor Commented:
Yes, but if I should use MSXML2 in Excel then I would need an url to insert into the DOMDocument.
What would that url be if I store it on a safedir? Or do I have to create another script to get it from the safedir?
0
 
shobinsunCommented:
Hi,

Please clarify tour need?
0
 
Gaute RønningenOwner, DeveloperAuthor Commented:
Was as I suspected, just needed to know if there was any other way of doing it. Thanks. :-)
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.