Re: Stupid question of the day (Editing text file in $HOME via web)

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

 



On 31 Oct 2006, at 09:20 , Ed Lazor wrote:
On Oct 30, 2006, at 11:34 PM, Google Kreme wrote:
So, do I whack up something where I just load the file into a HTML Textarea and then write it back (simple enough, though possibly rather dangerous), or is there something straightforward I should go ahead and use that might find use elsewhere on the server?

Playing Devils Advocate here, but why not store the text in a database?

Because the text file is used by egrep/procmail.

The text file should be somewhat secure if you're manually reading and writing to it in PHP, making sure that you're the one controlling the file name, the file extension (file type), the file permissions, and the file size.

Yeah, so just dump it into a textarea and go?

On 31 Oct 2006, at 10:32 , Richard Lynch wrote:
On Tue, October 31, 2006 1:34 am, Google Kreme wrote:
So, do I whack up something where I just load the file into a HTML
Textarea and then write it back (simple enough, though possibly
rather dangerous), or is there something straightforward I should go
ahead and use that might find use elsewhere on the server?

The unanswered question is:

How many people might try to edit it at once, and what will you do to
resolve race conditions?

There will be only one person able to access the file, but I will need to somehow 'time-out' a edit if it doesn't get committed.

1. Put the "file" in a database as individual (AAA) XXX-NNNN records,
and the "file" can be generated from the DB every time it changes with
a trigger, or every day or something reasonable.  Having individual
records for each line reduces the damage of the race condition to a
single entry needing to be re-done.  You can also more easily find
code to handle the race condition for the DB in a web environment.

That's not a bad idea. It might be worth the effort to setup the database and then simply have a php scriptlette generate the actual plaintext. Hmm. Worth considering, at least. Some way of generating the plain text only when the file changes would be needed though,a s I don't expect it to change all that often.


2. Put the file into subversion or CVS, if all editors are developers.

Nope, it needs to be luser friendly.

3. Forget the web interface, because the file won't really change that
often anyway, and just use 'vi' to make the rare change. :-)

See above.

There likely *IS* a web tool "out there" just like you want...

Yeah, that's what I was thinking.

My first guess would be to check out the various "panel" solutions for
having a web interface that webhosts provide to edit what is
essentially a simple text file, which configures the web server, mail
server, ftp server, etc.  These all have all the exact same issues you
will face, so there might be one that fits your needs.

Any specific recommendations? The only one of these I am familiar with is the absurdly expensive cpanel.

--
"You can think and you can fight, but the world's always movin', and if you wanna stay ahead you gotta dance."

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


[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