in reply to Urgent help needed by inexperienced programmers
I don't know how specific your assignment is, but my suggestion would be to do something like this, if you can:
(Mostly static page w/ form for user name and password, and code to display an error message if one is specified.)
-->
(Script which tests user/pass, and either redirects to first page with login error, or displays questionaire form, with user/pass as hidden vars.)
-->
(Script which again tests user/pass, redirecting to page one on error, verifies validity of questionaire answers, redirecting to page 2 on error, and (if all is well) logs answers, etc.)
Security Issues:
1) Serve this with SSL if possible. Otherwise you're transmitting password data in clear text over the network. If you don't have access to a secure server, this method is no worse than any other (short of a java app implementing PKI, which would probably be a bit overboard ;)
2) Pages containing passwords may remain in browser cache. There are various ways to solve this. The easiest would probably be to have the page which recieves the form submission from the login page set a temporary cookie containing the user/pass data, instead of passing it around in hidden form variables. The validation page would then simply test for an appropriate user/pass from the cookie, instead of from the form.
Another option is the use of a "magic cookie" number. (NOT the same thing as a browser cookie, don't get confused). A "magic cookie" is a random number (long enough to be unguessable) that the server generates when it validates your login. The number is then tied to your identity in a file (or DB, or some more esoteric method of storing data) on the server. The magic cookie is then passed back to the browser in the hidden form variables, instead of the user/pass. The validation script gets the magic cookie, and compares it to the file to find the user. The advantage of this method is magic cookies can be timed out, so If I steal the number from your browser's cache an hour or two after you've used it, it's no longer valid, and I can't impersonate you.
--
Ryan Koppenhaver, Aspiring Perl Hacker
"I ask for so little. Just fear me, love me, do as I say and I will be your slave."
|
|---|