On Tue, 21 Aug 2001 19:41:29 -0500, "Richard Lynch" <[EMAIL PROTECTED]>
wrote:

>> I can generate some random value to be used for the session_id, but I
>> can't think of a good way to store it for use on the first page.
>
>Why does it matter if they hit refresh and get a new session ID before
>you've collected any information about that ID?...


Good user interface design can be difficult to achieve in a browser
environment, and many of the browser form interfaces I have seen are
poorly designed in terms of user experience.

I've created a multipart form without any "page expired" messages, no
matter what the user does.  It's pretty slick, as far as browser form
interfaces go.

The user can use the browser back button, the browser forward button,
the browser refresh button, or the form "next" button anywhere in the
series of pages, all without disturbing any responses already entered.

Say they fill out 5 pages, then decide to go back and review the first
page before completing page 6.  In that case, I don't want to create a
new session, and thereby discard all the responses already entered, in
case they happen to hit refresh while on page 1.

Why? That's just good "user interface design 101."


>About all you *COULD* do is have a "fake" first page that does:
>
><?php
>    $session_id = md5(rand());
>    header("Location: page2.php?session_id=$session_id");
>?>
>


Art Wells gave me an idea how to do it all on a single page, and here
is what I worked out from his idea:

 <?
 $PHP_SELF = $HTTP_SERVER_VARS['PHP_SELF'];
 session_start();
 if (!session_is_registered('vsid')) {
     session_register('vsid');
     $HTTP_SESSION_VARS['vsid'] = session_id();
     $sidurl = "Location: $PHP_SELF" . '?' . SID;
     header("$sidurl");
     exit();
 }
 ....
 .... other code on first page
 ....
 ?>


Thanks to all for the ideas!

Egan




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to