...can't just tag it on the end of the URL as plain text when passing it between scripts, cos we are required to keep the user identity secure.

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."


In reply to Re: Urgent help needed by inexperienced programmers by rlk
in thread Urgent help needed by inexperienced programmers by Anonymous Monk

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.