Re: [PHP] Current dilema for Novice

2005-03-01 Thread Richard Lynch
James Marcinek wrote:
 - New directories may be created by various individuals

Who?
How?
How do you know they are who they say they are, and that they *SHOULD* be
allowed?

 - provide security for each directory (and sub-directory) under
 $_SERVER['DOCUMENT_ROOT'].

What does this even mean?

You've got no real definition here for what you actually want.

Security against what action from whom under what circumstances?

And who is supposed to be allowed when?

 - Use parent directory of each .htm file (since there will be only one) as
 the
 name of the link to the file

But what's to stop two users from making a sub-sub-directory named 'admin'
and then you recursively visit them, and find a file 'foo.htm' and they
are both in 'admin'?

 - Prevent displaying of other directories under $_SERVER['DOCUMENT_ROOT']

Which other directories?
Which ones are kosher, which are not?

 - Each site is currently configured to use Apache Digest Authentication.

Check browser implementations and compatibility...

Not sure they all ever got around to implementing that.

 My
 experience with PHP site design comes from the book 'PHP and MySQL Web
 Development' which mainly dealt with web sites as Applications
 (e-commerce,
 blog, etc) and not from a file system stand point. Most was object
 oriented with
 includes and what not which would require pages in every subdirectory
 under the
 DOCUMENT_ROOT in order to comply with the application design. Having a
 solution
 to require this would not be practical; however I'm not sure if there's
 another
 way to approach.

In php.ini you could set an append file that every site would get that
has all the PHP in it you want them to have on every page.

 If anyone has any suggestions (and estimations of time it would take) I
 would
 appreciate it.

The rest of this stuff is your basic PHP directory functions:
http://php.net/opendir
http://php.net/readdir
and then using arrays and recursion to keep track of where you are and
what you want to show the user.
You should be able to find sample code for all that in the PHP Manual and
its User Contributed notes, or Google if all else fails.

-- 
Like Music?
http://l-i-e.com/artists.htm

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



Re: [PHP] Current dilema for Novice

2005-03-01 Thread Richard Lynch
 In php.ini you could set an append file that every site would get that
 has all the PHP in it you want them to have on every page.

Damn!

append  auto_prepend

Post-lunch sugar low?

No, I had to double-post earlier today as well.

Sleep deprivation, yeah, that's my excuse.

-- 
Like Music?
http://l-i-e.com/artists.htm

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



[PHP] Current dilema for Novice

2005-02-28 Thread James Marcinek
Hello Everyone,

I'm somewhat new to PHP. I've read quite a bit of material and have a background
with perl and Apache and Linux.

Let me explain my situation.

- Fedora Core 3 with Apache 2 and PHP 
- Using SSL.
- Each Directory under $_SERVER['DOCUMENT_ROOT'] is an NFS mounted directory
(read only).
- The directories may contain various numbers of subdirectories
- New directories may be created by various individuals
- The application data being stored can be accessed by an application created
.htm file.
- The .htm file created by the application always has the same name.

My goals are:
- provide encrypted connection
- provide security for each directory (and sub-directory) under
$_SERVER['DOCUMENT_ROOT'].
- Find all files with a .htm suffix by recursively going through all
sub-directories.
- Create links for each .htm file on a single page.
- Use parent directory of each .htm file (since there will be only one) as the
name of the link to the file
- Prevent displaying of other directories under $_SERVER['DOCUMENT_ROOT']
- Single Sign page for all customers
- Each user will only have access to one directory under
$_SERVER['DOCUMENT_ROOT']
- Authentication process should move customer to appropriate directory under
$_SERVER['DOCUMENT_ROOT']

What I've done so far:

First, let me state that some of the requirments weren't initially present when
the design started...

- The server has been set up with SSL and is working properly
- The SSL site goes to $DOCUMENT_ROOT (which is currently a blank index.htm)
file, preventing users from drilling down
- Each site is currently configured to use Apache Digest Authentication. My
experience with PHP site design comes from the book 'PHP and MySQL Web
Development' which mainly dealt with web sites as Applications (e-commerce,
blog, etc) and not from a file system stand point. Most was object oriented with
includes and what not which would require pages in every subdirectory under the
DOCUMENT_ROOT in order to comply with the application design. Having a solution
to require this would not be practical; however I'm not sure if there's another
way to approach. By using the Digest Authentication I know that the Directories
in the realm would be covered...
- My original index.php script (that I need to debug as it's not working yet)
was designed to be placed in each respective directory directly under
DOCUMENT_ROOT. The script, hopefully, will go through each directory, find out
what files are directories or files. If it's a file I'm trying to push basename
(but needs to get the directory name it resides instead) and the URL if the file
suffix ends with .htm. If it's a directory, it should push the directory to an
array. Calling a function in a while loop and shifting the array should
recursively take me through all subdirectories. The end result should be a table
on the index file that the user's would be able to click on to take to the .htm
file. Right now I'm having a problem with my foreach statement...

What's needed:
- Simple but effective. It's not going to be feasible to add a lot of .php files
to subdirectories. These directories are really working directories so this is a
headache. There are more that just .htm files. That is not the problem. Just
don't want the people to have to dig down.
-A single sign-on would be great. Each user only needs to access one directory
under DOCUMENT_ROOT. I know that SSL uses the IP address and I can't break up
the SSL into multiple virtual hosts so I can't do that. The security must
provide protection from somebody trying to get in from a subdirectory

From my limited knowledge of PHP, I would think that creating a solution to
support this would take some time. But like I said I sure don't know everything.

If anyone has any suggestions (and estimations of time it would take) I would
appreciate it.

Thanks,

James

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