mapping form fields to database and handling multiple users
by Bennett Haselton <bennett(at)peacefire.org>
|
Date: |
Sun, 01 Jul 2001 02:54:11 -0700 |
To: |
hwg-servers(at)hwg.org |
|
todo: View
Thread,
Original
|
|
I've written a Web-based application that allows users to log in and edit
profile data associated with their username. Right now the application
consists of perl code written from scratch, and for each username, the
"database" storing information for that username is just a flat text file.
The perl code I've written actually does an OK job -- handling logins for
multiple users just involves checking a username and password against a
text file, and then reading another text file that stores the user's
settings, and filling in the correct values in form fields. Sometimes it's
an advantage that I've written everything from the ground up -- for
example, I wanted to have a field in the user's settings file that
indicated whether the user had changed a particular setting in the last 24
hours. I just added new "Fieldname_HasChanged" field, and altered the
update code so that the new value would be checked against the old value,
and "Fieldname_HasChanged" would be set to 1 if they were different. If I
had been using an out-of-the-box solution, I doubt if that kind of
low-level tinkering would have been possible.
On the other hand, since I'm about to rewrite the application using a more
scalable language and a better database system anyway, are there pre-built
solutions already out there for handling either or (ideally) both of the
following situations:
- The site stores accounts for multiple users. Users log in through a form
on the main page; the system hides the details of how user login states are
maintained (through cookies, or cryptic URL strings, or whatever). While
logged in, users can view multiple pages whose content depends on the
user's account details.
- The server stores data associated with each user. When a user logs in to
the site, they see a page containing form fields with values filled in
corresponding to the user's data. They can edit and update their data by
changing the values in these form fields and clicking an Update button.
Both of these are, admittedly, not very hard to code by hand, but a
pre-built solution would decrease the chances of some tiny logic error
creeping in and trashing large amounts of user data.
Ideally I'm looking for a way to do it in server-side Java, since Java is
the language that the application will probably be re-written in. (I have
to stop using perl since I've found that I can write code much, much faster
with statement completion and drop-down fill-in-the-blank capability in my
code editor, which means I have to use some language supported by Visual
Studio. Of course this means I have to put up with a lot of ribbing from
friends who eat assembly code for breakfast.)
-Bennett
bennett(at)peacefire.org http://www.peacefire.org
(425) 649 9024
HWG: hwg-servers mailing list archives,
maintained by Webmasters @ IWA