You are here: Re: Session destroy help « All PHP « IT news, forums, messages
Re: Session destroy help

Posted by shimmyshack on 03/05/07 10:58

On 4 Mar, 22:57, "J.O. Aho" <u...@example.net> wrote:
> rsvore wrote:
> > Currently the destroy is at the end of the script but if I'm on step one of
> > the form and go to step two and decide to go back to step 1 by using the
> > back button in IE it destroys session the step1 values and I have to
> > repopulate the fields. I have an include that pulls the DB population script
> > so I will try the destroy there.
>
> I would put in an extra page in the beginning, as you have it now, I guess, is:
>
> page with link to form
>
> first form page
>
> second form page
>
> ...
>
> yes or no page
>
> kill session page
>
> This has the funny thing that you recreate a session if you use the backwards
> buttons and I guess thats what makes your session to be recreated. Do this
> instead:
>
> page with link to form
>
> page creates session and then forward to next page with header()
>
> first form page
>
> second form page
>
> ...
>
> yes or no page
>
> kill session page
>
> When you back from "first form page" you will come to "page with link to form"
> without a new session is created. No new session is created when you go from
> "second form page" to "first form page" as the session isn't created on that page.
>
> Of course you can keep things like it is, but you have to check if there is a
> session or not when you load "first form page", if none detected create a new
> session, if session detected don't do anything.
>
> I hope you did follow this quite late evening post.
>
> --
>
> //Aho

can I just clarify, if there is already an exsisting session, why
doesn't the call to session_start() pick up on that fact and refuse to
create a new session.
php manual: "session_start() creates a session or resumes the current
one based on the current session id that's being passed via a request,
such as GET, POST, or a cookie"

It seems to me that was must be happening at the moment, for data to
be lost is that the variables are pushed to a completely new session
each time the form POSTs, this just seems to defeat the point of
sessions to me?

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация