Trap for the referral page in the callFile.php page.

Allow the proper referral page to pass (could be multiple pages if you
choose) but if the users modify the URL of the GET the referral page will be
blank or perhaps more precise the referrer var will be empty and

Do a phpinfo and look for the var:


this will allow them to try to modify the url and you will know who is
attempting it  --  if you'd care to know that info.

Mark Cain

----- Original Message -----
From: "mel list_php" <[EMAIL PROTECTED]>
To: <>
Sent: Monday, April 11, 2005 5:59 AM
Subject: [PHP-DB] using POST data for a readfile

> Hi list,
> (mail problem you may get that one twice!)
> My problem: I protect my files by storing them out of the web root or
> a htaccess.
> As I'm not using the htaccess authentication for my users, I use a
> to serve the file, basically something like:
> <a href='callFile.php?id=test.pdf'>File to serve</a>
> and in the script callFile something like
> this works fine, but I just would like to use a post instead of a get, to
> avoid my users trying to modify the url.
> I tried to use a function in the callFile script, something like:
> function getFile ($fileId)   {
> readfile($fileId);
> }
> if (isset($_POST['fileId']))
> {
> $fileId=$_POST['fileId'];
> getFile($fileId);
> }
> but it doesn't work.
> I also tried to do a require_once (callFile.php) and then later on call
> getFile function from the first script but no more success.
> Does anybody has any idea on how to do that?
> Thanks,
> Melanie
> _________________________________________________________________
> Want to block unwanted pop-ups? Download the free MSN Toolbar now!
> --
> PHP Database Mailing List (
> To unsubscribe, visit:

PHP Database Mailing List (
To unsubscribe, visit:

Reply via email to