Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

admin. guestbook

by deriwana (Initiate)
on Jun 15, 2001 at 06:21 UTC ( [id://88695]=perlquestion: print w/replies, xml ) Need Help??

deriwana has asked for the wisdom of the Perl Monks concerning the following question:

Does anyone know of a way to edit guestbook entries with a script? In other words, I'm wanting to create a Q/A section (much like this one) that displays a response from an administrator (possibly in italics) to be added WITHIN the posts. I already have a non-threaded guestbook setup that writes entries to an html file...and that is the file I want to edit, with an output to a user friendly admin page. any help would be appreciated

Replies are listed 'Best First'.
Re: admin. guestbook
by tachyon (Chancellor) on Jun 15, 2001 at 08:02 UTC

    At it's simplest, presuming you have access to this HTML file, just edit it with a text editor. Simply insert your comments between <i>Your comments here</i>

    As you mention a user friendly admin page I presume you want to do this editing across the web. Again at its simplest you want a script to read the file you want to edit and then output a web page containing a text area. This text area is set to the contents of the file to be edited so you get an editable copy of the file in your browser. You then insert your comments wherever you want. When you press submit this text area is sent back to the script where it is used to rewrite the original file. Thus you have edited the file over the web. This is the basic HTML your script would need to output.

    <html> <head> <title>Admin Page</title> </head> <body onLoad="document.form.text.focus()"> <form method="POST" name="form" action="/cgi-bin/myscript.pl"> <p> <textarea rows="20" name="text" cols="75"> File text to edit goes here via variable </textarea> </p> <p> <input type="submit" value="Submit" name="submit"> <input type="reset" value="Reset" name="reset"> </p> </form> </body> </html>

    It is hard to be much more specific given your somewhat vague request. I'm sure you will get more feedback if you can be more specific as to the details.

    cheers

    tachyon

Re: admin. guestbook
by Beatnik (Parson) on Jun 15, 2001 at 09:02 UTC
    Personally I try to avoid editing HTML files directly (in a CGI context that is). You might want to check SSI (Server Side Includes), which basically can insert script output in a HTML file (without actually changing the HTML file). The other way is have a pure CGI guestbook (no/minimal HTML files).

    Greetz
    Beatnik
    ... Quidquid perl dictum sit, altum viditur.
      Sorry for my vagueness before, I'll try to clear some things up..
      The file that the guestbook writes to is more or less a flat-file database WITHOUT delimiters, so there isn't a way to single out entries unless a name, address, or zipcode-query is done to point to a certain area of the file to be edited.
      Ultimately, I would like the script to be able to edit the flat-file html page thru an admin. page like the one submitted by "Tachyon" (see above)....just the ability to edit the contents of a flat-file database(without obvious delimiters) over the web.
      Here is the guestbook script that creates the flat-file: http://204.33.180.159:8080/guest.txt

      Thanks to everyone who submitted a response.
Re: admin. guestbook
by marius (Hermit) on Jun 15, 2001 at 06:40 UTC
    deriwana,
    We really need more information than this. Are you planning on storing this information in a database, flat file, CSV file? You say you're already using a guestbook. Perhaps you should post the code here or a pointer to a webpage that has the code, so we can figure out how it stores data and how the editing needs to be done.

    -marius
      The guestbook stores the entries in a flat-file database; however, it creates just your standard html file..i.e., no delimiters to differentiate between the entries.
      Tackyon (see below) summarized it very well as to what I'm looking for.
      Here is the guestbook script:
      http://204.33.180.159:8080/guest.txt

      Thank you for your help

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://88695]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others chilling in the Monastery: (4)
As of 2024-04-19 16:55 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found