Hide paths for files

Ask about general coding issues or problems here.

Moderators: macek, egami, gesf

medirecpr
New php-forum User
New php-forum User
Posts: 1
Joined: Tue Nov 20, 2012 10:00 am

Hide paths for files

Postby medirecpr » Tue Nov 20, 2012 10:06 am

Hello all, I am new to PHP, and have been tasked with adding functionality to an existing dynamic webpage.

I have a link for logged in users, that displays an xml/xsl file:

Code: Select all

<?php
echo "../patientfiles/".$_SESSION['Login']."/ccd".$_SESSION['Login'].".xml";
?>


however, if a user copies the url, he/she may paste it in the browser at any time and access the file w/o logging in.

is there a way to display the file in the browser, without giving up the path?

Kindest regards,

seandisanti
php-forum Fan User
php-forum Fan User
Posts: 838
Joined: Mon Oct 01, 2012 12:32 pm

Re: Hide paths for files

Postby seandisanti » Tue Nov 20, 2012 12:42 pm

There are several ways to do what you're trying to do. the easiest way is probably to include an .htaccess denying access to all, and then have your server side scripts display it when logged in.


Return to “PHP coding => General”

Who is online

Users browsing this forum: No registered users and 1 guest

cron