Re: Current dilema for Novice

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I know that you were posting a lot of detail because you wanted to make
it clear what you were doing, but next time you might try to be a little
more succinct in your description.  Give us the most relevant facts...
not a flame, just some friendly advice to get you (more) answers to your
question.

James Marcinek wrote:
> Hello Everyone,
...
> 
> - 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 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. 
...

So I assume this is the script we are helping you to debug?  Great.

> 
> 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.

Well it sounds like you want to use something like a filemap.  Go
through each subdirectory and cache this result somehow (XML, array,
object, DB?).  If you go this route you will also want the following
features:

- a way to update the filemap (deletions / file moves / etc.)
- a way to force regeneration of the filemap (in case files become
orphaned and/or you have ghost files that don't really exist on disk)
- a way to read from the filemap (i.e. the recursive listing)
- possibly with a filtering feature for .htm or whatever (be careful
with those PCRE's ;)

Why go to this trouble?  Because if there are really an unlimited number
of files / directories / users... and you are trying to manually
reconstruct this array (read through all subdirectories) for each user
each time... well, you get the picture.  I wasted a lot of time trying
to go that route before.  :(

> -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

See this list's previous discussions about verifying users.

> 
> 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.

A good place to start if you're serious about this project is this page:
http://www.php.net/~helly/php/ext/spl/classRecursiveDirectoryIterator.html

*Note* This is a PHP5 only feature, but it is quite handy for this task.
   If PHP5 is an option for your site then I would recommend it.  If
it's not then you could certainly hack up something that would do
exactly the same thing... but that would take a lot longer than
piggybacking on PHP's SPL.  :)  How long I don't know for sure, but you
could probably contact the author of RecursiveDirectoryIterator for an
idea...

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

Time required is going to depend on a few factors:
- is PHP5 / SPL an option for your site?
- Are you familiar with other SPL classes (esp. iterator)

Answering yes to both of these questions is going to cut down your
development time... and (probably) your maintenance time as well.

-- 
Teach a man to fish...

NEW? | http://www.catb.org/~esr/faqs/smart-questions.html
STFA | http://marc.theaimsgroup.com/?l=php-general&w=2
STFM | http://php.net/manual/en/index.php
STFW | http://www.google.com/search?q=php
LAZY |
http://mycroft.mozdev.org/download.html?name=PHP&submitform=Find+search+plugins

Attachment: signature.asc
Description: OpenPGP digital signature


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux