Page 1 of 1

Linking to files outside public_html

Posted: Thu Oct 01, 2009 12:02 pm
by tehhparadox
Hi guys

Well, my problem is that I can't link to a .php file outside public_html. I made a new folder, and when I put the file inside it, people can't just type the URL in and go to it. I want to open this file after a password has been confirmed and I have no idea how to.

I'll be grateful for any help

Re: Linking to files outside public_html

Posted: Fri Oct 02, 2009 2:10 am
by kaisellgren

Code: Select all

/home/account/public_html/index.php
/home/account/non_public/path/to/file.txt
index.php

Code: Select all

<?php
 
echo file_get_contents('../non_public/path/to/file.txt');

Re: Linking to files outside public_html

Posted: Sat Oct 03, 2009 6:49 am
by tehhparadox
thanks Kai!
I needed that info. I can't check that code just now cos my hosting's down, but thanks all the same.