|
Posted by mootmail-googlegroups on 10/05/06 15:56
cendrizzi wrote:
> Hi all,
> I've read some stuff on this but can't seem to come up with a solution
> that works right. I have a semi-mature (yet very large and robust)
> internal web application that currently only works with one window open
> at a time.
>
> Maybe I'm abusing the use of $_SESSION but I have data entry processes
> split up in several steps (which is required since depending on what
> was put before determines what pages will be shown after). To store
> this information between the steps I use the session, which is the only
> way I know that this would be possible (uses arrays in arrays). So if
> I were to open up a window and start the data entry it would overwrite
> the last one.
>
> So one thought was trying to create an instance id that that is
> randomly generated that is passed between the pages using a $_GET
> variable. Using this id I would create and reference custom session
> variables making sure each instance is completely unique. This seems
> to be consistent with what others have tried but I don't think it would
> work since if someone middle clicked on a page link it would open up a
> new tab (in firefox and IE7) with the same instance id with. There
> doesn't seem to me to be an easy way to ensure that each window in a
> browser has it's own, unique, instance.
>
> Surely this isn't unique to me so how in the world can I ensure that
> each window/tab gets a unique id of some sort so that my session is
> unique for each one?
>
> Lastly, if necessary, I wouldn't mind trying to suppress a new window
> but this is plagued with the same issues (how do I know it's a new
> window/tab?). I know this is not ideal but given the nature of the
> application this wouldn't be a big problem.
>
> Thanks in advance.
Without knowing the specifics of your application, I can only talk in
general terms. But I have a few thoughts.
I don't like the idea of having multiple sessions running for one user,
but you can take your original idea and make it work within one session
easily. Instead of using that unique value you generate as a session
id, just make it a key value for an array which will hold your user's
data as they progress. Pass that key value along in hidden form
elements so that each time through the process, the user is writing to
a different part of the session. If you generate a new, unique key at
each 'step1', then no matter how many windows they have open, each one
will be using it's own data.
I also don't like the idea of preventing the user from opening a new
window, and I suspect, neither will they. I guess if there is no other
option, then on 'step1', you can check to see if partial data is
already in the session and, if so, alert the user to either continue
with that data, or blow it away and start over from scratch. But in
all honesty, you should try to anticipate that the user WILL do things
out of the order you expect, and work around that, not force them into
one particular path.
Navigation:
[Reply to this message]
|