Yucky, yucky code there in guestbook.txt. . .
There probably isn't going to be an easy way to edit the guestbook file. Probably the easiest, messiest, way to do it would be to read the whole file in, then print it out HTML escaped into a <textarea></textarea> part of a form. This will put the HTML into the textarea, too. This will also be really slow if the guestbook gets large. Make sure the form "POSTS" and doesn't "GET", otherwise you won't be able to shuffle around that much data.
You really should use CGI.pm to parse form data, it also has very good HTMLescape and unescape functions.
After your client does the edits in the textarea, write the whole file out again after the POST. Be sure to lock the file. There are many problems with this. If the transfer gets stopped, mid-stream, you could lose data. Plus, with a large guest book this will be slow.
There are better ways to do this, but not many that I can think of that wouldn't involve you cleaning up the data format.
I'm sure other monks would have a better way.
Update: I didn't see the other thread. What I suggested was already put out by tachyon. deriwana you really should post followup questions in the same thread in the future. Thanks!
|