[PHP] Protecting a file via PHP.

2003-09-16 Thread Steve Jackson
I just read this:
http://zend.com/zend/trick/tricks-august-2001.php
To protect 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? No matter
what I've tried I get no error message and the browser (IE6) just hangs
so it appears that PHP is trying to serve the file but failing for some
reason.

What is that directory I am supposed to define?

What am I doing wrong? 

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

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



Re: [PHP] Protecting a file via PHP.

2003-09-16 Thread - Edwin -
Hi,

Steve Jackson [EMAIL PROTECTED] wrote:

 I just read this:
 http://zend.com/zend/trick/tricks-august-2001.php
 To protect a file via PHP.

Didn't really read this but...

 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.

 No matter
 what I've tried I get no error message and the browser (IE6) just hangs
 so it appears that PHP is trying to serve the file but failing for some
 reason.

Could be a different problem...

- E -
__
Do You Yahoo!?
Yahoo! BB is Broadband by Yahoo!
http://bb.yahoo.co.jp/

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



FW: [PHP] Protecting a file via PHP.

2003-09-16 Thread Steve Jackson


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/abr\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