Steve Jackson
Web Development and Marketing Manager
Viola Systems Ltd.
http://www.violasystems.com
[EMAIL PROTECTED]
Mobile +358 50 343 5159





-----Original Message-----
From: Steve Jackson [mailto:[EMAIL PROTECTED] 
Sent: 16. syyskuuta 2003 12:15
To: '[EMAIL PROTECTED]'
Subject: RE: [PHP] Protecting a file via PHP.


> > What does this part mean in the serving the files part:
> >     define('FILEDIR', '/mnt/dos/');
> > 
> > Do I define the directory where the file is served from? Or do I
> > define a directory to which the file is served to (a temp) or what?
> 
> It should be "from" and not "to".

OK. The thing is I wonder why in the zend article the directory here is
different. There are two scripts on the page: <? 
    define('FILEDIR', '/downloads/'); 

    //display available files 
    $d = dir(FILEDIR); 
    while($f = $d->read()) 
    { 
        //skip 'hidden' files 
        if($f{0} != '.') 
        { 
            print("<a href=\"get.php?file=$f\">$f</a><br>\n"); 
        } 
    } 
    $d->close(); 
?> 

This first one looks in the downloads directory (outside the root) and
grabs the filenames displaying them as a link. This works fine on my
server.

This second one starts with:
define('FILEDIR', '/mnt/dos/');

And I can't see an explanation why. Surely if it was meant to be the
same the writer would have had the same route defined?

 
> 
> Could be a different problem...
> 

Could be. But I'm trying to eliminate this one first. I've tried the
from directory and get the same error as I menioned previously. If I
can't get this to work are there any other ways I can protect a file
from being displayed. I need to be able to:
1) Display links to authenticated users (php session)
2) Let authenticated users download the files.

I don't want to use an htaccess file unless there is a way to
authenticate the user in htaccess by reading the session variable.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to