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

Hi! I have the following scenario:

A user logs into the admin area of my site, where he/she can change some text in a text box (original text was entered by this user before). Then the newly changed text has to be saved somewhere (DB or textfile), and when somebody accesses this users site (www.website.com/user), it should get the info from the DB or textfile and dump that data into the appropriate area in the HTML file.

Can anyone help me on what the best solution to this would be and how I should go about setting it up. I would greatly appreciate any kind of help.

Thanks in advacnce to all, Surya

PS: I am very sorry if I haven't been able to explain the situation properly....... please do tell me and I will try and explain better. :-)

  • Comment on Hi! I need help on user admin + HTML output situation.....

Replies are listed 'Best First'.
Re: Hi! I need help on user admin + HTML output situation.....
by jepri (Parson) on Jun 16, 2001 at 16:14 UTC
    First up I'd ask why you can't let the user it his own webpages himself. I set up WebDAV for our users and it's been a winner all around. The users can mount their websites as folders on windoze machines and there is a command line interface for Unix style OSs. There's even a port for a Mac.

    The full niceness of the interface can only be appreciated on windows machines because they can treat files as if they were local, and so use their favourite HTML tools.

    If you can't do that, you could write a CGI script (using CGI.pm 'perldoc CGI' for more info) to edit a text file that is included into their HTML page using SSI (Server Side Includes).

    If none of this is familiar to you, this would be a great project to extend your Perl skills, but it will take a few days to feel comfortable with all the stuff you will have to deal with.

    ____________________
    Jeremy
    I didn't believe in evil until I dated it.

Re: Hi! I need help on user admin + HTML output situation.....
by Hero Zzyzzx (Curate) on Jun 16, 2001 at 17:02 UTC

    jepri got it. However, WebDAV may be more appropriate for users who are in your company/organization and are more technical. You may want/need a different system for a more disperse / less technically able group of users.

    Look into CGI.pm for all your CGI needs. It's really, really worth learning and a huge timesaver! "Roll your own" form parsing is doomed to failure.

    If you're going to be supporting a lot of users, and/or a lot of concurrent users, you should probably look into a database solution. Flat text will leave you flat (ouch.)

    DBI programming is pretty simple, if you're already familiar with SQL and database concepts.

    You'll also need to think about a couple things:

    1. User authentication / session management. There's a relatively good thread here.
    2. HTML output. Though this may seem maybe a little ahead of where you're at, I highly suggest you learn HTML::Template, a good quick primer is here, thanks to Ovid. This will allow you to separate your code from your HTML, greatly simplifing maintenance and customizability down the road.